[英]ava + ts-node converting .spec.ts files into .ts
I am running ava with ts-node with the following config:我正在使用具有以下配置的 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
}
The problem is that .spec.ts
files don't get recognized, as ts-node is doing some kind of conversion (I think) of the .spec.ts
files into just .ts
, which means that the extension with spec.ts
is never matched.问题是
.spec.ts
文件无法被识别,因为 ts-node 正在将.spec.ts
文件进行某种转换(我认为)到.ts
,这意味着带有spec.ts
的扩展名永远不会匹配。
Here's the output of the tests这是测试的 output
- graphql › stage-2 › workspace.ts › do later
✔ general › functions.ts › returns proper difference
The files are named workspace.spec.ts
and functions.spec.ts
这些文件被命名为
workspace.spec.ts
和functions.spec.ts
Is there anyway for ts-node to not drop the spec
part? ts-node 无论如何都不会放弃
spec
部分吗?
ts-node
should only kick in when AVA requires the test file. ts-node
应该只在 AVA 需要测试文件时启动。 I can't immediately spot why this isn't working.我无法立即发现为什么这不起作用。 Are those
spec.ts
files inside the tests
directory?这些
spec.ts
文件是否在tests
目录中?
PS NODE_ENV
already defaults to test
, and you don't need to disable tap
either. PS
NODE_ENV
已经默认为test
,您也不需要禁用tap
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.