首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >tsconfig.json -为tsconfig文件以上的目录添加filesGlob条目

tsconfig.json -为tsconfig文件以上的目录添加filesGlob条目
EN

Stack Overflow用户
提问于 2017-03-10 17:40:37
回答 1查看 2K关注 0票数 1

我正在尝试使用Typescript在现有的Zend Framework2项目上创建CasperJS前端测试。

ZF2项目结构设置如下:

代码语言:javascript
复制
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找到并编译每个应用程序模块测试目录中的所有测试文件,并将其放到根目录/ *.casper.ts /前端中的一个临时目录中。大约有30个模块。

目前,我的文件如下所示:

代码语言:javascript
复制
{
  "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规则?就像这样:

代码语言:javascript
复制
"../../../module/**/test/UI/Tests/Demo/*.casper.ts"

谢谢

EN

回答 1

Stack Overflow用户

发布于 2020-07-20 19:54:06

从TypeScript2.0开始,随着includetsconfig.json中的引入,tsconfig.jsondeprecated

include中指定的路径支持glob模式。

此外,请使用带有双星号的casper.ts文件的更宽路径,如下所示:

代码语言:javascript
复制
{
"compilerOptions": {
 ...
},
"include": ["./**/casper.ts"]
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42715025

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档