https://github.com/kentcdodds/jest-esmodules
https://github.com/kentcdodds/jest-esmodules
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kentcdodds/jest-esmodules
- Owner: kentcdodds
- Created: 2021-03-10T03:04:55.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-10T03:05:01.000Z (over 5 years ago)
- Last Synced: 2025-04-23T00:07:16.698Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 45.9 KB
- Stars: 41
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Using Jest with native ESModules
This is a minimal repo that uses native ES modules and works with jest
1. `package.json` specifies this package as a `module` type.
2. `jest.config.js` disables the built-in babel transform with `transform: {}`.
Note that this is not actually required for the tests to work, but it is if
you want the ESModules to be executed as coded rather than being transformed.
3. `package.json`'s `test` script runs jest via `node` with the
`--experimental-vm-modules` flag. Hopefully this won't be required in the
long-term when this required feature is no longer experimental.
[Learn more](https://jestjs.io/docs/ecmascript-modules)