我的问题是,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)