Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
* `[docs]` Add tutorial page for ES6 class mocks.
([#5383]https://github.com/facebook/jest/pull/5383))
* `[jest-resolve]` Search required modules in node_modules and then in custom
paths.
([#5403](https://github.com/facebook/jest/pull/5403))
paths. ([#5403](https://github.com/facebook/jest/pull/5403))
* `[jest-resolve]` Get builtin modules from node core.
([#5411](https://github.com/facebook/jest/pull/5411))

## jest 22.1.4

Expand Down Expand Up @@ -1493,4 +1494,4 @@ See https://facebook.github.io/jest/blog/2016/12/15/2016-in-jest.html

## <=0.4.0

* See commit history for changes in previous versions of jest.
* See commit history for changes in previous versions of jest.
6 changes: 4 additions & 2 deletions packages/jest-resolve/src/is_builtin_module.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@
* @flow
*/

// $FlowFixMe: Flow doesn't know about the `module` module
import {builtinModules} from 'module';

// https://github.com/facebook/flow/pull/5160
declare var process: {
binding(type: string): {},
};

const BUILTIN_MODULES =
module.builtinModules ||
builtinModules ||
Object.keys(process.binding('natives')).filter(
(module: string) => !/^internal\//.test(module),
);

export default function isBuiltinModule(module: string): boolean {
// $FlowFixMe: module.builtinModules is not added to the flow type definitions yet
return BUILTIN_MODULES.indexOf(module) !== -1;
}