fix(runtime): user can use dynamic import in code when running tests#15842
Conversation
Signed-off-by: hainenber <dotronghai96@gmail.com>
Signed-off-by: hainenber <dotronghai96@gmail.com>
✅ Deploy Preview for jestjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
babel-jest
babel-plugin-jest-hoist
babel-preset-jest
create-jest
@jest/diff-sequences
expect
@jest/expect-utils
jest
jest-changed-files
jest-circus
jest-cli
jest-config
@jest/console
@jest/core
@jest/create-cache-key-function
jest-diff
jest-docblock
jest-each
@jest/environment
jest-environment-jsdom
@jest/environment-jsdom-abstract
jest-environment-node
@jest/expect
@jest/fake-timers
@jest/get-type
@jest/globals
jest-haste-map
jest-jasmine2
jest-leak-detector
jest-matcher-utils
jest-message-util
jest-mock
@jest/pattern
jest-phabricator
jest-regex-util
@jest/reporters
jest-resolve
jest-resolve-dependencies
jest-runner
jest-runtime
@jest/schemas
jest-snapshot
@jest/snapshot-utils
@jest/source-map
@jest/test-result
@jest/test-sequencer
@jest/transform
@jest/types
jest-util
jest-validate
jest-watcher
jest-worker
pretty-format
commit: |
Signed-off-by: hainenber <dotronghai96@gmail.com>
|
|
||
| // Source: https://github.com/jestjs/jest/issues/15823 | ||
| test('test double with dynamic import', () => { | ||
| expect(double(2)).toBe(4); |
There was a problem hiding this comment.
Should this test use the newly added function doubleWithDynamicImport? The test title indicates that dynamic import is used but the test body doesn't say that
There was a problem hiding this comment.
Thanks for catching this! I've fixed in latest commit. Too much autocompletion reliance, I suppose :D
There was a problem hiding this comment.
LGTM 👍 I think you might need to fix unit tests to improve code coverage. I suspect that adding the condition && !supportsDynamicImport requires some adjustments for unit tests
Signed-off-by: hainenber <dotronghai96@gmail.com>
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Resolves #15823
When user specifies feature flag to enable ESM support from Node.js runtime,
jest-runtimeshould tolerate dynamic imports. I've verified that tests added in #14110 are still holding so the extended condition should ideally fix referred issue within an acceptable impact radius.Test plan