错误 TS2688 中的错误:找不到“jest"的类型定义文件 [英] ERROR in error TS2688: Cannot find type definition file for 'jest'
本文介绍了错误 TS2688 中的错误:找不到“jest"的类型定义文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 angular 6 应用程序,我正在使用 karma + jasmine 来运行我的测试.但是当我运行 ng test
时,我收到以下错误:
I have an angular 6 application and I'm using karma + jasmine to run my tests. but when I run ng test
I'm getting the following error:
错误 TS2688 中的错误:找不到 'jest' 的类型定义文件.
ERROR in error TS2688: Cannot find type definition file for 'jest'.
有人知道如何解决这个问题吗?
Any one knows how to solve this problem?
推荐答案
我没有意识到在我的 tsconfig.spec.json
中我使用的是 jest
而不是jasmin
在 types
节点中.另外,我缺少配置.
I didn't realized that in my tsconfig.spec.json
I was using jest
instead of jasmin
in types
node. Also, I had a missing configuration.
所以,我已经改变了:
{
"extends": "./tsconfig.es5.json",
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"outDir": "../out-tsc/spec",
"module": "commonjs",
"target": "es6",
"baseUrl": "",
"types": [
"jest",
"node"
]
},
"files": [
"**/*.spec.ts"
]
}
为此:
{
"extends": "./tsconfig.es5.json",
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"outDir": "../out-tsc/spec",
"module": "commonjs",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts",
"polyfills.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
这个改变解决了我的问题.
And this changes solves my problem.
这篇关于错误 TS2688 中的错误:找不到“jest"的类型定义文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文