简体   繁体   English

除.spec.js之外的每个.js文件的节点glob模式

[英]Node glob pattern for every .js file except .spec.js

I am looking for a better glob pattern for usemin, i want to to find all .js files but exclude the .spec.js files. 我正在为usemin寻找更好的glob模式,我想找到所有.js文件,但不包括.spec.js文件。 I have the following solution so far. 到目前为止,我有以下解决方案。

<script src="components/**/*(.js|!(*.spec.js|*.scss))"></script>

The solution i have at the moment requires me to keep adding file extensions to exclude them, else they get picked up, for example .html files. 我现在的解决方案要求我不断添加文件扩展名以排除它们,否则它们会被拾取,例如.html文件。

I tried to make it only look for .js files and exclude the .spec.js from them but it does not seem to work. 我试图让它只查找.js文件并.spec.js排除.spec.js但它似乎不起作用。

Also adding a !components/**/*.spec.js as another script below does not seem to work. 另外在下面添加一个!components/**/*.spec.js作为另一个脚本似乎不起作用。

这个glob包括所有*.js但不包括*.spec.js

components/**/!(*.spec).js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Protractorjs Spec.js文件中实现IF语句? - How to implement IF statement in Protractorjs Spec.js file? 使变量在整个 spec.js 文件中可用 - Make a variable available throughout a spec.js file 在1个Spec.js文件中测试2个或更多JavaScript文件? - Testing 2 or more JavaScript files in 1 Spec.js file? 强制业力从磁盘上获取更新的spec.js文件 - Force Karma to take updated spec.js file from disk Jest 方法在 .spec.js 文件中不可用 - Jest methods not available in .spec.js files 这种模式是如何工作的:'test / e2e / ** / * .spec.js'? - How does this pattern work: 'test/e2e/**/*.spec.js'? 将一个文件夹中的 .js 文件导入另一个文件夹中的 spec.js 文件时出错 - Error when importing .js file in one folder to spec.js file in another folder 赛普拉斯运行规范选项不适用于 .spec.js 文件 - Cypress run spec option not working with .spec.js files ReactJS:未定义错误:如何在 spec.js 测试文件中从 authContext 定义 isAuthorized() 和 logonID? - ReactJS: Undefined Error: How to define isAuthorized() and logonID from authContext in spec.js test file? 在测试用例中编写量角器spec.js文件,从浏览器中获取会话值 - Getting the session values from the browser in test case writing protractor spec.js file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM