Skip to content

Commit

Permalink
add git hook for test.only and suite.only (fixes aframevr#3094)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngokevin committed Sep 29, 2017
1 parent 7c26f33 commit 31387d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"lint": "semistandard -v | snazzy",
"lint:fix": "semistandard --fix",
"precommit": "npm run lint",
"prepush": "node scripts/testOnlyCheck.js",
"prerelease": "node scripts/release.js 0.6.1 0.7.0",
"start": "npm run dev",
"test": "karma start ./tests/karma.conf.js",
Expand Down
11 changes: 11 additions & 0 deletions scripts/testOnlyCheck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env node
var fs = require('fs');
var glob = require('glob');

glob.sync('tests/**/*.test.js').forEach(testFile => {
var contents = fs.readFileSync(testFile, 'utf-8');
if (contents.indexOf('test.only') !== -1 || contents.indexOf('suite.only') !== -1) {
console.error('[PRE-PUSH HOOK ERROR] Please remove `test.only` or `suite.only` from tests!');
process.exit(1);
}
});

0 comments on commit 31387d6

Please sign in to comment.