@checkdigit/jest-config
v6.0.1
Published
Check Digit standard Jest configuration
Downloads
6,543
Maintainers
Keywords
Readme
jest-config
Copyright (c) 2023–2024 Check Digit, LLC
Check Digit Jest presets and configuration.
Install
$ npm i @checkdigit/jest-config --save-dev
Note that @checkdigit/jest-config
automatically brings in the correct versions of
jest
, ts-jest
and @jest/globals
via peerDependencies
. Do not install these packages separately.
ESM
@checkdigit/jest-config
is now ESM only.
It only supports testing with ESM modules,
i.e., you must have "type": "module"
in your package.json
file.
Note that the Node --experimental-vm-modules
flag is required for ESM modules. See the
Jest docs for more information.
.env
The project .env
file is automatically loaded via process.loadEnvFile()
(available in Node.js 20.12 or later).
Example
ESM package.json
Note: this requires Node.js v20.11 or later.
{
// ...
"type": "module",
"scripts": {
"test": "NODE_OPTIONS=\"--disable-warning ExperimentalWarning --experimental-vm-modules\" jest --coverage=false"
"test:coverage": "NODE_OPTIONS=\"--disable-warning ExperimentalWarning --experimental-vm-modules\" jest --coverage=true"
}
// ...
"jest": {
"preset": "@checkdigit/jest-config"
}
}
License
MIT