Jest matcher import is breaking webpack projects.
See original GitHub issueThe Issue
This project, or one of its dependencies, has an incorrect import path. This causes the test suite to crash whenever the rxSandbox.create() function is called.
The offending import is here: https://github.com/kwonoj/rx-sandbox/blob/master/src/assert/marbleAssert.ts
Steps to reproduce:
Create a new Angular project. Import rxSandbox and call the create() function.
Error Log
ERROR in ./node_modules/jest-matchers/node_modules/pretty-format/build-es5/plugins/ReactElement.js
Module not found: Error: Can't resolve 'babel-runtime/helpers/typeof' in 'E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\build-es5\plugins'
resolve 'babel-runtime/helpers/typeof' in 'E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\build-es5\plugins'
Parsed request is a module
using description file: E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\package.json (relative path: ./build-es5/plugins)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
looking for modules in E:/test/dddd
using description file: E:\test\dddd\package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
using description file: E:\test\dddd\package.json (relative path: ./babel-runtime/helpers/typeof)
no extension
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\babel-runtime\helpers\typeof doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\babel-runtime\helpers\typeof.ts doesn't exist
.tsx
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\babel-runtime\helpers\typeof.tsx doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\babel-runtime\helpers\typeof.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\babel-runtime\helpers\typeof.js doesn't exist
as directory
E:\test\dddd\babel-runtime\helpers\typeof doesn't exist
E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\build-es5\plugins\node_modules doesn't exist or is not a directory
E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\build-es5\node_modules doesn't exist or is not a directory
E:\test\dddd\node_modules\jest-matchers\node_modules\node_modules doesn't exist or is not a directory
E:\test\dddd\node_modules\node_modules doesn't exist or is not a directory
E:\test\node_modules doesn't exist or is not a directory
E:\node_modules doesn't exist or is not a directory
looking for modules in E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\node_modules
using description file: E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
looking for modules in E:\test\dddd\node_modules\jest-matchers\node_modules
using description file: E:\test\dddd\node_modules\jest-matchers\package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
looking for modules in E:\test\dddd\node_modules
using description file: E:\test\dddd\package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
using description file: E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\package.json (relative path: ./node_modules/babel-runtime/helpers/typeof)
no extension
Field 'browser' doesn't contain a valid alias configuration
using description file: E:\test\dddd\node_modules\jest-matchers\package.json (relative path: ./node_modules/babel-runtime/helpers/typeof)
no extension
Field 'browser' doesn't contain a valid alias configuration
using description file: E:\test\dddd\package.json (relative path: ./node_modules/babel-runtime/helpers/typeof)
no extension
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\node_modules\babel-runtime\helpers\typeof doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\node_modules\jest-matchers\node_modules\babel-runtime\helpers\typeof doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\node_modules\babel-runtime\helpers\typeof doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\node_modules\babel-runtime\helpers\typeof.ts doesn't exist
.tsx
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\node_modules\jest-matchers\node_modules\babel-runtime\helpers\typeof.ts doesn't exist
.tsx
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\node_modules\babel-runtime\helpers\typeof.ts doesn't exist
.tsx
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\node_modules\babel-runtime\helpers\typeof.tsx doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\node_modules\jest-matchers\node_modules\babel-runtime\helpers\typeof.tsx doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\node_modules\babel-runtime\helpers\typeof.tsx doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\node_modules\babel-runtime\helpers\typeof.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\node_modules\jest-matchers\node_modules\babel-runtime\helpers\typeof.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\node_modules\babel-runtime\helpers\typeof.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\node_modules\babel-runtime\helpers\typeof.js doesn't exist
as directory
E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\node_modules\babel-runtime\helpers\typeof doesn't exist
E:\test\dddd\node_modules\jest-matchers\node_modules\babel-runtime\helpers\typeof.js doesn't exist
as directory
E:\test\dddd\node_modules\jest-matchers\node_modules\babel-runtime\helpers\typeof doesn't exist
E:\test\dddd\node_modules\babel-runtime\helpers\typeof.js doesn't exist
as directory
E:\test\dddd\node_modules\babel-runtime\helpers\typeof doesn't exist
[E:\test\dddd\babel-runtime\helpers\typeof]
[E:\test\dddd\babel-runtime\helpers\typeof.ts]
[E:\test\dddd\babel-runtime\helpers\typeof.tsx]
[E:\test\dddd\babel-runtime\helpers\typeof.mjs]
[E:\test\dddd\babel-runtime\helpers\typeof.js]
[E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\build-es5\plugins\node_modules]
[E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\build-es5\node_modules]
[E:\test\dddd\node_modules\jest-matchers\node_modules\node_modules]
[E:\test\dddd\node_modules\node_modules]
[E:\test\node_modules]
[E:\node_modules]
[E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\node_modules\babel-runtime\helpers\typeof]
[E:\test\dddd\node_modules\jest-matchers\node_modules\babel-runtime\helpers\typeof]
[E:\test\dddd\node_modules\babel-runtime\helpers\typeof]
[E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\node_modules\babel-runtime\helpers\typeof.ts]
[E:\test\dddd\node_modules\jest-matchers\node_modules\babel-runtime\helpers\typeof.ts]
[E:\test\dddd\node_modules\babel-runtime\helpers\typeof.ts]
[E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\node_modules\babel-runtime\helpers\typeof.tsx]
[E:\test\dddd\node_modules\jest-matchers\node_modules\babel-runtime\helpers\typeof.tsx]
[E:\test\dddd\node_modules\babel-runtime\helpers\typeof.tsx]
[E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\node_modules\babel-runtime\helpers\typeof.mjs]
[E:\test\dddd\node_modules\jest-matchers\node_modules\babel-runtime\helpers\typeof.mjs]
[E:\test\dddd\node_modules\babel-runtime\helpers\typeof.mjs]
[E:\test\dddd\node_modules\jest-matchers\node_modules\pretty-format\node_modules\babel-runtime\helpers\typeof.js]
[E:\test\dddd\node_modules\jest-matchers\node_modules\babel-runtime\helpers\typeof.js]
[E:\test\dddd\node_modules\babel-runtime\helpers\typeof.js]
@ ./node_modules/jest-matchers/node_modules/pretty-format/build-es5/plugins/ReactElement.js 1:128-167
@ ./node_modules/jest-matchers/node_modules/pretty-format/build-es5/index.js
@ ./node_modules/jest-matchers/node_modules/jest-matcher-utils/build-es5/index.js
@ ./node_modules/jest-matchers/build/matchers.js
@ ./node_modules/rx-sandbox/dist/src/assert/marbleAssert.js
@ ./node_modules/rx-sandbox/dist/src/index.js
@ ./src/app/app.component.spec.ts
@ ./src sync \.spec\.ts$
@ ./src/test.ts
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
SyntaxError: Cannot use import statement outside a module ...
When you use ECMAScript Modules in Node (v13.6.0 for me) combined with Jest, the following error occurs: SyntaxError: Cannot use import ...
Read more >Importing images breaks jest test - Stack Overflow
When you import image files, Jest tries to interpret the binary codes of the images as .js, hence runs into errors.
Read more >Change: "Jest uses custom config" to "Jest uses webpack" (#5 ...
Currently our Jest config does not use webpack for transpiling. This causes a bit of duplication in configuration between webpack configuration ...
Read more >Using with webpack - Jest
Jest can be used in projects that use webpack to manage assets, styles, ... We've told Jest to ignore files matching a stylesheet...
Read more >Tree Shaking - webpack
Tree shaking is a term commonly used in the JavaScript context for dead-code elimination. It relies on the static structure of ES2015 module...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
published 1.0.4.
@selangley-wa https://github.com/kwonoj/rx-sandbox/tree/release-1.x is up