我正在使用 OSX,在我的package.json文件中我有脚本条目:
"lint": "eslint ./src/**/*.js"
但是,当我运行时,npm lint只考虑对第一级目录进行 linting,例如。./src/dir/*不是./src/dir/nested_dir/*。
我的印象是**glob 表示递归搜索?
有谁知道我怎样才能让它按预期运行?
我们安装了karma,它使用mocha和chai进行测试.我们正在尝试使用karma-babel-preprocessor将babel直接整合到业力中,以便将我们的ES6文件转换为ES5来运行.使用mocha单独使用babel,即mocha测试命令,但我们尝试使用karma而不是它不起作用.
karma.conf.js片段:
frameworks: ['mocha', 'chai'],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'src/**/*.js': ['babel'],
'test/**/*_spec.js': ['babel']
},
"babelPreprocessor": {
options: {
presets: ['es2015'],
sourceMap: 'inline'
},
filename: function(file) {
return file.originalPath.replace(/\.js$/, '.es5.js');
},
sourceFileName: function(file) {
return file.originalPath;
}
},
// list of files / patterns to load in the browser
files: [
'src/**/*.js',
'test/**/*_spec.js'
],
Run Code Online (Sandbox Code Playgroud)
package.json片段:
"scripts": {
"test": "./node_modules/karma/bin/karma start karma.conf.js"
},
"babel": {
"presets": ["es2015"]
},
"devDependencies": { …Run Code Online (Sandbox Code Playgroud)