我正在尝试使用Typescript在现有的Zend Framework 2项目上创建CasperJS前端测试。
ZF2项目结构设置如下:
project
- .composer
- config
- data
- module
-- Application
-- Module1
--- config (module1 config)
--- src (php sources)
--- view (module1 view files)
--- test
---- Module1Test (has PHPUnit tests)
---- UI
----- Tests
------ SubArea
------ testArea.casper.ts
-- Module2
...
- public
- vendor
- tests
-- backend
-- frontend
--- casperjs
...
---- tsconfig.json
我正在尝试让我的tsconfig.json找到并编译每个应用程序模块Test目录中的所有* .casper.ts文件,并进入root / tests / frontend内的临时目录。大约有30个模块。
目前我的文件如下所示:
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"sourceMap": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"outDir": "./_tmp/build/"
},
"filesGlob": [
"../../../module/**/test/UI/Tests/Demo/*.casper.ts",
"!./node_modules/**/*.ts"
],
"exclude": [
"node_modules"
]
}
但它找不到任何文件。
如何在tsconfig.json文件本身上方的目录中创建filesGlob规则? 就像:
"../../../module/**/test/UI/Tests/Demo/*.casper.ts"
谢谢
答案 0 :(得分:0)
filesGlob
是deprecated,自Typescript 2.0起在include
中引入了tsconfig.json
。
include
中指定的路径支持全局模式。
此外,请使用带有双星号的casper.ts
文件的较宽路径,如下所示:
{
"compilerOptions": {
...
},
"include": ["./**/casper.ts"]
}