Skip to content

Commit

Permalink
Build: Use grep to filter test cases.
Browse files Browse the repository at this point in the history
* Uses different strategy to test binary.
* Test two cases and declare the binary OK.
Issue URL: sass#611.
  • Loading branch information
am11 committed Jan 8, 2015
1 parent 6539e7b commit 5b5e4dc
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,33 +115,23 @@ function testBinary(options) {
return build(options);
}

if (process.env.SKIP_NODE_SASS_TESTS) {
return;
}

fs.stat(path.join(__dirname, '..', 'vendor', options.bin, 'binding.node'), function (err) {
if (err) {
return build(options);
}

console.log('`' + options.bin + '` exists; testing');

var total;
var failures;
var mocha = new Mocha({
ui: 'bdd',
timeout: 999999,
reporter: function(stats) {
total = stats.total;
failures = stats.failures;
}
timeout: 999999
});

mocha.addFile(path.resolve(__dirname, '..', 'test', 'api.js'));
mocha.run(function () {
if ((total - failures) * 100 / total < 90) {
mocha.grep(/should compile sass to css with file/).run(function (done) {
if (done !== 0) {
console.log([
'Problem with the binary: ' + failures + ' of ' + total + ' tests are failing.',
'Problem with the binary.',
'Manual build incoming.',
'Please consider contributing the release binary to https://github.com/sass/node-sass-binaries for npm distribution.'
].join('\n'));
Expand Down

0 comments on commit 5b5e4dc

Please # to comment.