see the instructions on jest"s official website to download ts-jest, but I don"t know how to use it, and no clear tutorials have been found. Please help me
see the instructions on jest"s official website to download ts-jest, but I don"t know how to use it, and no clear tutorials have been found. Please help me
first step to install the package:
yarn add -D typescript jest ts-jest @types/jest
step 2: initialize project-related configuration files:
generate tsconfig.json:
tsc --init
create jest.config.js:
module.exports = {
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
}
directory structure:
base.spec.ts:
:
Previous: Ionic3 in the browser with the browser back button does not return animation
Next: The problem of setting Spring-Boot yml as configuration file under IDEA