Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
找不到TypeScript before()和after()_Typescript_Testing_Npm_Jestjs_Supertest - Fatal编程技术网

找不到TypeScript before()和after()

找不到TypeScript before()和after(),typescript,testing,npm,jestjs,supertest,Typescript,Testing,Npm,Jestjs,Supertest,尝试使用Jest/SuperTest在TypeScript中运行测试-但是,当我运行npm test时,它返回以下错误: 我缺少/没有导入什么包 FAIL test/test.ts ● Test suite failed to run test/test.ts:8:3 - error TS2304: Cannot find name 'before'. 8 before(PlatformTest.bootstrap(Server)); ~~~~~~

尝试使用Jest/SuperTest在TypeScript中运行测试-但是,当我运行
npm test
时,它返回以下错误:

我缺少/没有导入什么包

 FAIL  test/test.ts
  ● Test suite failed to run

    test/test.ts:8:3 - error TS2304: Cannot find name 'before'.

    8   before(PlatformTest.bootstrap(Server));
        ~~~~~~
    test/test.ts:9:3 - error TS2304: Cannot find name 'before'.

    9   before(() => {
        ~~~~~~
    test/test.ts:12:3 - error TS2304: Cannot find name 'after'.

    12   after(PlatformTest.reset);
以下是我的作品:

import {PlatformTest} from "@tsed/common";
import * as SuperTest from "supertest";
import {Server} from "../src/Server";

请检查您是否选择了正确的全局变量,说笑的是,在()之后没有
之前()
,但在每个()之后有
之前有

所有jest globals可在此处找到: