我正在使用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部分?
发布于 2020-06-21 21:29:36
只有当AVA需要测试文件时,ts-node才会生效。我不能立即找出为什么这不起作用。这些spec.ts文件是否在tests目录中?
P.S. NODE_ENV已经默认为test,您也不需要禁用tap。
https://stackoverflow.com/questions/62464539
复制相似问题