【问题标题】:Glob ignore node test filesGlob 忽略节点测试文件
【发布时间】:2018-06-21 14:27:51
【问题描述】:

我的项目结构与此类似:

dist
  - *
node_modules
  - *
source
  - *.js
  - *.spec.js
  - *.test.js
  - *.vue
  - __tests__
tests
  - *.js
  - *.spec.js
  - *.test.js

我尝试创建一个 glob 以仅获取代码文件 vuejs,但我不知道喜欢在 source 目录中退出 spectest 文件。

我当前的 glob 是:project/!(node_modules|dist|__tests__|tests)**/*.+(!(spec|test)|vue|js)

这将获取source this 中的所有文件,忽略__tests__ 文件夹。我怎么能忽略*.spec.js*.test.js 文件呢?

【问题讨论】:

    标签: glob


    【解决方案1】:

    这是一个迟到的答案,但也许有人会从中获利:

    project/!(node_modules|dist|__tests__|tests)**/(!(*.spec|*.test)|.vue|.js)

    神奇的部分是这个:/**/!(*.test).js,您可以忽略所有包含.test.js 的文件并导入所有其他 .js 文件。

    【讨论】:

      猜你喜欢
      • 2019-09-30
      • 1970-01-01
      • 2021-08-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多