Angular 在tsconfig.spec.json和jest.config.js中使用jest
我在一个有角度的项目中使用玩笑。在这个项目中,我有以下两个文件 tsconfig.spec.js jest.config.js 在tsconfig.spec.json中,我有以下内容Angular 在tsconfig.spec.json和jest.config.js中使用jest,angular,jestjs,Angular,Jestjs,我在一个有角度的项目中使用玩笑。在这个项目中,我有以下两个文件 tsconfig.spec.js jest.config.js 在tsconfig.spec.json中,我有以下内容 { "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../out-tsc/spec", "types": [ "jest", "node" ], "module": "comm
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"types": [
"jest",
"node"
],
"module": "commonjs",
"allowJs": true
},
"files": [
"polyfills.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
module.exports = {
testEnvironment: "jsdom",
transform: {
".+\\.(css|styl|less|sass|scss)$":
"<rootDir>/node_modules/jest-css-modules-transform",
},
};
在jest.config.json中,我有以下内容
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"types": [
"jest",
"node"
],
"module": "commonjs",
"allowJs": true
},
"files": [
"polyfills.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
module.exports = {
testEnvironment: "jsdom",
transform: {
".+\\.(css|styl|less|sass|scss)$":
"<rootDir>/node_modules/jest-css-modules-transform",
},
};
基本上,我有三个配置文件,根据我对angular.json->tsconfig.spec.js->jest.config.json的理解。这是正确的还是我遗漏了什么,有什么方法可以简化这一点