Jest added to project with aliasing and eslint rules.
Jest is not supported esm & esm mocks yet, that's why we are forced to use jest-esm-transformer (Babel transform under the hood test modules & *.spec
scripts to CommonJs).
Without transform
configuration we have error: SyntaxError: Cannot use import statement outside a module
.
Nowadays (2022-01-12) we can esm without Babel only by ts-jest?
No! ts-jest uses Babel too and is only needed to catch additional type errors.
Read more:
- Pure ESM package gist
- Setting up Jest with ESM gist
- jest-clean-console-reporter
- awesome-jest#reporters
- ts-jest with old 2019 configuration for ts tested modules & ts tests
- another "boilerplate" ts-jest configuration
- StyleLint trying move to esm (jest too)
- Chromium headless & page model by Playwright ("Автотесты на базе playwright и jest")
- javascript-testing-best-practices
- nodejs-integration-tests-best-practices
100% Func coverage is fixed by migrating from function to Object.