我正在使用具有以下配置的ts-node运行ava:
"ava": {
"files": [
"tests/**/*",
"!test/exclude-files-in-this-directory",
"!**/exclude-files-with-this-name.*"
],
"failFast": true,
"failWithoutAssertions": false,
"extensions": [
"spec.ts",
"ts"
],
"environmentVariables": {
"NODE_ENV": "test"
},
"require": [
"ts-node/register",
"tsconfig-paths/register"
],
"tap": false,
"verbose": true
}
问题在于.spec.ts
文件未被识别,因为ts-node正在将.spec.ts
文件进行某种转换(我认为)为.ts
,表示与spec.ts
的扩展名是不匹配的。
这是测试的输出
- graphql › stage-2 › workspace.ts › do later
✔ general › functions.ts › returns proper difference
文件名为workspace.spec.ts
和functions.spec.ts
反正ts-node是否不会删除spec
部分?
答案 0 :(得分:0)
viewBox
仅在AVA需要测试文件时才启动。我无法立即发现为什么这行不通。这些ts-node
文件位于spec.ts
目录中吗?
P.S。 tests
已默认为NODE_ENV
,您也无需禁用test
。