mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
improvement: run single test with mochacli
This commit is contained in:
parent
d269358d95
commit
85e21223ce
1 changed files with 16 additions and 9 deletions
25
Gruntfile.js
25
Gruntfile.js
|
@ -18,7 +18,6 @@ var _ = require('lodash'),
|
|||
cwd = process.cwd().replace(/( |\(|\))/g, escapeChar + '$1'),
|
||||
buildDirectory = path.resolve(cwd, '.build'),
|
||||
distDirectory = path.resolve(cwd, '.dist'),
|
||||
mochaPath = path.resolve(cwd + '/node_modules/.bin/mocha'),
|
||||
emberPath = path.resolve(cwd + '/core/client/node_modules/.bin/ember'),
|
||||
|
||||
// ## Grunt configuration
|
||||
|
@ -208,7 +207,10 @@ var _ = require('lodash'),
|
|||
src: [
|
||||
'core/test/functional/module/**/*_spec.js'
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
// #### Run single test (src is set dynamically, see grunt task 'test')
|
||||
single: {}
|
||||
},
|
||||
|
||||
// ### grunt-mocha-istanbul
|
||||
|
@ -289,12 +291,6 @@ var _ = require('lodash'),
|
|||
}
|
||||
},
|
||||
|
||||
test: {
|
||||
command: function (test) {
|
||||
return 'node ' + mochaPath + ' --timeout=15000 --ui=bdd --reporter=spec --colors core/test/' + test;
|
||||
}
|
||||
},
|
||||
|
||||
shrinkwrap: {
|
||||
command: 'npm shrinkwrap'
|
||||
},
|
||||
|
@ -501,7 +497,18 @@ var _ = require('lodash'),
|
|||
grunt.fail.fatal('No test provided. `grunt test` expects a filename. e.g.: `grunt test:unit/apps_spec.js`. Did you mean `npm test` or `grunt validate`?');
|
||||
}
|
||||
|
||||
grunt.task.run('test-setup', 'shell:test:' + test);
|
||||
test = 'core/test/' + test;
|
||||
|
||||
// CASE: execute folder
|
||||
if (!test.match(/.js/)) {
|
||||
test += '/**';
|
||||
} else if (!fs.existsSync(test)) {
|
||||
grunt.fail.fatal('This file does not exist!');
|
||||
}
|
||||
|
||||
cfg.mochacli.single.src = [test];
|
||||
grunt.initConfig(cfg);
|
||||
grunt.task.run('test-setup', 'mochacli:single');
|
||||
});
|
||||
|
||||
// ### Validate
|
||||
|
|
Loading…
Add table
Reference in a new issue