Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/topheman/jest-esm-experiments
https://github.com/topheman/jest-esm-experiments
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/topheman/jest-esm-experiments
- Owner: topheman
- Created: 2019-08-03T10:30:44.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T06:37:11.000Z (almost 2 years ago)
- Last Synced: 2024-04-08T00:39:39.483Z (9 months ago)
- Language: JavaScript
- Size: 782 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jest-esm-experiments
This project is a minimal reproducible bug of the [problem I encountered in my other project topheman/webrtc-experiments](https://github.com/topheman/webrtc-experiments/blob/master/NOTES.md).
```
git clone
```## 1) Due to following error:
```
TypeError: Jest: a transform must export a `process` function.
```**Downgrading to [email protected]** - [source](https://github.com/kenotron/esm-jest/issues/5#issuecomment-503016224)
## 2) Not working even with esm setup as loader for jest
Basic [`jest.config.js`](jest.config.js):
```js
module.exports = {
transform: {
"\\.m?jsx?$": "esm"
},
moduleNameMapper: {
"^anotherRoot/(.*)$": "/lib/anotherRoot/$1"
},
transformIgnorePatterns: []
};
```When you run `npm test`, you fill get the following error:
```
PASS src/common.test.js
FAIL src/string.test.js
● Test suite failed to runTypeError: Cannot read property 'next' of undefined
at Object.n.(anonymous function) (node_modules/esm/esm.js:1:1796)
FAIL src/math.test.js
● Test suite failed to runTypeError: Cannot read property 'next' of undefined
at Object.n.(anonymous function) (node_modules/esm/esm.js:1:1796)
Test Suites: 2 failed, 1 passed, 3 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 1.457s
Ran all test suites
```This might be due to the fact that `src/common.js` file is being imported:
- directly in one of the tests
- indirectly by the components I'm testing in the 2 other tests