Skip to content

Commit

Permalink
hardened runner.js
Browse files Browse the repository at this point in the history
first check if definition tester module exists at all
  • Loading branch information
Bartvds committed Oct 7, 2014
1 parent 2e8478a commit 0c7b3c1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions _infrastructure/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ function getSemFloat(str) {
}

var repo = readJSON(path.resolve(__dirname, '..', 'package.json'));
var test = readJSON(path.resolve(__dirname, '..', 'node_modules', 'definition-tester', 'package.json'));

var testerPath = path.resolve(__dirname, '..', 'node_modules', 'definition-tester', 'package.json');

// ultra lame semver major/minor check
if (getSemFloat(repo.dependencies['definition-tester']) > getSemFloat(test.version)) {
if (!fs.existsSync(testerPath) || getSemFloat(repo.dependencies['definition-tester']) > getSemFloat(readJSON(testerPath).version)) {
console.log('DefinitelyTyped tester needs an update!\n\n please run \'npm install\'\n');
process.exit(1);
}
Expand Down

0 comments on commit 0c7b3c1

Please sign in to comment.