From eb9f3f82712d6f653246890d5e59a21ffb7c4a92 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Mon, 23 Oct 2017 05:33:49 +0200 Subject: [PATCH] Add changelog entry for #4740 (#4742) --- CHANGELOG.md | 1 + .../src/__tests__/is_builtin_module.test.js | 4 +++- packages/jest-resolve/src/is_builtin_module.js | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da217d7ac122..4c44b8ae306d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * `[jest-runtime]` Move `babel-core` to peer dependencies so it works with Babel 7 ([#4557](https://github.com/facebook/jest/pull/4557)) * `[jest-util]` Fix `runOnlyPendingTimers` for `setTimeout` inside `setImmediate` ([#4608](https://github.com/facebook/jest/pull/4608)) * `[jest-message-util]` Always remove node internals from stacktraces ([#4695](https://github.com/facebook/jest/pull/4695)) +* `[jest-resolve]` changes method of determining builtin modules to include missing builtins ([#4740](https://github.com/facebook/jest/pull/4740)) ### Features * `[jest-environment-*]` [**BREAKING**] Add Async Test Environment APIs, dispose is now teardown ([#4506](https://github.com/facebook/jest/pull/4506)) diff --git a/packages/jest-resolve/src/__tests__/is_builtin_module.test.js b/packages/jest-resolve/src/__tests__/is_builtin_module.test.js index c57289b8fe82..2dc35db31bbc 100644 --- a/packages/jest-resolve/src/__tests__/is_builtin_module.test.js +++ b/packages/jest-resolve/src/__tests__/is_builtin_module.test.js @@ -1,4 +1,6 @@ -const isBuiltinModule = require('../is_builtin_module'); +// @flow + +import isBuiltinModule from '../is_builtin_module'; describe('isBuiltinModule', () => { it('should return true for the `path` module', () => { diff --git a/packages/jest-resolve/src/is_builtin_module.js b/packages/jest-resolve/src/is_builtin_module.js index a244c9f95af0..8f8e9a92a247 100644 --- a/packages/jest-resolve/src/is_builtin_module.js +++ b/packages/jest-resolve/src/is_builtin_module.js @@ -1,3 +1,13 @@ +/** + * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + */ + +// https://github.com/facebook/flow/pull/5160 declare var process: { binding(type: string): {}, }; @@ -6,6 +16,6 @@ const BUILTIN_MODULES = Object.keys(process.binding('natives')).filter( (module: string) => !/^internal\//.test(module), ); -module.exports = function isBuiltinModule(module: string): boolean { +export default function isBuiltinModule(module: string): boolean { return BUILTIN_MODULES.indexOf(module) !== -1; -}; +}