小编Use*_*er1的帖子

打字稿摩卡描述不是功能

我的问题是,mocha-typescript不断抛出describe未定义的错误。

    TypeError: mocha_typescript_1.describe is not a function
    at DatabaseTest.WrongPath (test/database_test.ts:21:9)
    at Context.<anonymous> (node_modules/mocha-typescript/index.ts:218:22)
Run Code Online (Sandbox Code Playgroud)

我的tsconfig.json

    {
      "compilerOptions": {
        "target": "es6",
        "module": "commonjs",
        "outDir": "dist",
        "sourceMap": true,
        "lib": ["es6"],
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "noUnusedLocals": true,
        "noUnusedParameters": true,
        "typeRoots": [
          "./node_modules/@types"
        ],
        "types": [
          "node", "mocha", "chai"
        ]
      },
      "include": [
        "src/**/*.ts",
        "test/**/*.ts"
      ],
      "exclude": [
        "node_modules"
      ]
    }
Run Code Online (Sandbox Code Playgroud)

我的package.json

    {
      //omitted
      "main": "App.js",
      "scripts": {
        "pretest": "tsc",
        "test": "nyc mocha --require ts-node/register test/**/*_test.ts ",
        "watch": "mocha-typescript-watch",
        "prepare": "tsc"
      },

      // …
Run Code Online (Sandbox Code Playgroud)

mocha.js describe typescript

5
推荐指数
1
解决办法
2968
查看次数

标签 统计

describe ×1

mocha.js ×1

typescript ×1