(打字稿)纱线测试找不到测试文件夹

我有一个package.json文件,将测试定义为

"test": "TS_NODE_CACHE=true TS_NODE_PROJECT=./test/unit/ NODE_ENV=test TZ=UTC nyc mocha --colors --require ts-node/register --r tsconfig-paths/register --no-ignore 'test/unit/**/*.ts'",

和我的Dev Dependencies

"devDependencies": {
"@types/cheerio": "^0.22.13","@types/html-to-text": "^1.4.31","@types/jsdom": "^12.2.4","@types/yargs": "8.0.3","chai": "4.2.0","nyc": "^14.1.1","prettier": "^1.19.1","prettier-tslint": "^0.4.2","ts-node": "^8.4.1","ts-node-test-register": "^8.0.1","tsconfig-paths": "3.9.0","tslint": "^5.20.1","tslint-config-prettier": "^1.18.0","typescript": "^3.7.2"

},

和我的依存关系为: "dependencies": { "@types/chai": "^4.2.4","@types/chai-fs": "^2.0.2","@types/mocha": "^5.2.7","@types/nock": "^11.1.0","@types/rimraf": "^2.0.3","@types/sinon-chai": "^3.2.3","@types/sinon-test": "^2.4.0","@types/winston": "^2.4.4","yargs": "10.1.2","apollo-boost": "^0.4.4","axios": "^0.19.0","cheerio": "^1.0.0-rc.3","mocha": "^6.2.2","prom-client": "^11.5.3","rimraf": "^3.0.0","sinon": "^7.5.0","sinon-chai": "^3.3.0","sinon-test": "^2.4.0","ssl-root-cas": "^1.3.1","winston": "^2.4.4" },

但是,当我尝试在包装上运行纱线测试时,它会显示:

✖ ERROR: ⨯ Unable to compile TypeScript:
error TS5058: The specified path does not exist: '/Users/qwert/Documents/projects/CTC/test/unit'.

我可以确认unit文件夹中有测试,并且已经在IDE中运行了这些测试。

有人可以告诉我如何获取ts节点来注册此路径吗?

编辑:test / unit中的tsconfig.json

{
"compilerOptions": {
    "noImplicitAny" : true,"strictNullChecks": true,"module": "commonjs","moduleResolution": "node","experimentalDecorators": true,"emitDecoratorMetadata": true,"noUnusedLocals": true,"forceConsistentCasingInFileNames": true,"target": "es6","outDir": "../build/job","rootDirs": [ "src/*","test/unit/*" ],"sourceMap": true,"baseUrl": "../../","removeComments": true,"paths": {
        "*": [ "src/*","bottleneck": [ "node_modules/bottleneck/bottleneck" ]
    }
},"compileonSave": true,"include": ["src/**/*.ts"
],"exclude": [ "node_modules","tests/**/*.ts"]

}

weiche 回答:(打字稿)纱线测试找不到测试文件夹

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3117405.html

大家都在问