Ste*_*ven 7 javascript regex webpack
我把我的测试,在同一文件夹作为我的成分,我想应用的WebPack装载机(istanbul-instrumenter-loader
)中的所有文件,除了正好叫的人spec.js
或与该结束*Spec.js
(因此两者components/SupportPage/spec.js
并actions/SupportActionsSpec.js
不会得到包括在内.我已经试过在regextester.com上获得正确的RegEx,但我无法让它工作.我错过了什么吗?
好的,我找到了。编写一个测试来包含所有文件,但排除特定的规范文件可能是错误的方法,我是这样解决的:
{
test: /.\.js$/,
exclude: /(node_modules|bower_components)\/|.[sS]pec\.js$/,
loader: 'istanbul-instrumenter'
}
Run Code Online (Sandbox Code Playgroud)