问题描述
您好,我正在学习 Mocha 和 Chai,所以我安装了以下依赖项:
mocha
、chai
、chai-http
及其类型定义。
所以我创建了一个文件夹:server.spec.ts
,代码如下:
import chai from 'chai';
import chaiHttp from 'chai-http';
import { app } from '../src/server';
//Assertion Style
chai.should();
chai.use(chaiHttp);
describe('SIGN UP ENDPOINT',() => {});
所以现在当我写:
describe
我在安装 mocha 类型的同时收到以下错误
Cannot find name 'describe'. Do you need to install type deFinitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`.
请问我哪里出错了,请帮忙看看
解决方法
您能否检查一下您的测试的打字稿配置,您可能需要手动将类型添加到类型数组中
"types": [
"mocha",...
]