-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmoonstone-extra-checks.js
38 lines (30 loc) · 1.11 KB
/
moonstone-extra-checks.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var shelljs = require('shelljs');
var _ = require('lodash');
var getMoonstoneExtraTests = function(){
var result = shelljs.exec('egrep -rl --include="*.js" "moonstone-extra" test', {silent: true});
var resultsArray = result.output.split('\n');
var moonstoneTests = _.map(resultsArray, function(result){
if(result !== ''){
return result.split('/')[3];
}
});
moonstoneTests.pop();
return moonstoneTests;
};
var getAllUsedTests = function(){
if(process.env.MOONSTONE_EXTRA === 'false'){
var moonstoneTests = getMoonstoneExtraTests();
var moonstoneString = moonstoneTests.join('|');
var extraTests = moonstoneString.substring(0, moonstoneString.length - 1);
var nonExtraCmd = 'egrep -rlL --include="*specs.js" "'+extraTests+'" test';
var nonExtraTests = shelljs.exec(nonExtraCmd, {silent: true});
var nonExtraTestsArr = nonExtraTests.output.split('\n');
nonExtraTestsArr.pop();
//returns array of all tests without moonstone-extra
return nonExtraTestsArr;
} else {
return ['test/**/*-specs.js'];
}
};
exports.getAllUsedTests = getAllUsedTests;
exports.getMoonstoneExtraTests = getMoonstoneExtraTests;