unit-jest
Jest preset for unit-testing
Installation
Install package:
npm i --save-dev @tramvai/test-unit-jest
Add new preset to your jest.config:
module.exports = {
preset: '@tramvai/test-unit-jest',
};
Explanation
This presets implements next settings:
- use jest-circus as testRunner
- default testEnvironment is
node
- uses
@swc-node/jest
for transformation - css files are mapped with
identity-obj-proxy
- image files are mapped to empty string
How To
Override testEnvironment for file
Based on jest doc
Just add at the start of test file following comment:
/**
* @jest-environment your-environment
*/