Skip to content

Commit

Permalink
Merge 20ad92c into 750c66c
Browse files Browse the repository at this point in the history
  • Loading branch information
ariya committed Jun 26, 2015
2 parents 750c66c + 20ad92c commit d896aff
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 2 deletions.
File renamed without changes.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"lint": "npm run check-version && npm run eslint && npm run jscs && npm run complexity",
"check-version": "node tools/check-version.js",
"jscs": "jscs esprima.js",
"eslint": "node node_modules/eslint/bin/eslint.js esprima.js",
"eslint": "node node_modules/eslint/bin/eslint.js -c .lintrc esprima.js",
"complexity": "node tools/list-complexity.js && cr -s -l -w --maxcyc 19 esprima.js",

"coverage": "npm run analyze-coverage && npm run check-coverage",
Expand All @@ -70,6 +70,8 @@
"benchmark": "node test/benchmarks.js",
"benchmark-quick": "node test/benchmarks.js quick",

"travis": "npm test && coveralls < ./coverage/lcov.info"
"coveralls": "coveralls < ./coverage/lcov.info",
"downstream": "node test/downstream.js",
"travis": "npm test && npm run coveralls && npm run downstream"
}
}
64 changes: 64 additions & 0 deletions test/downstream.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
var child_process = require('child_process'),
fs = require('fs');

function execute(cmd) {
child_process.execSync(cmd, { stdio: 'inherit' });
}

function copy_file(source, target) {
fs.writeFileSync(target, fs.readFileSync(source));
}

function test_project(project, repo) {
console.log();
console.log('==========', project);
console.log();
console.log('Cloning', repo, '...');
execute('git clone --depth 1 ' + repo + ' ' + project);

process.chdir(project);
console.log();
console.log('HEAD is');
execute('git log -n1');

console.log();
execute('npm install');

console.log();
console.log('Replacing esprima.js with a fresh one...');
copy_file('../../esprima.js', './node_modules/esprima/esprima.js');

console.log();
try {
execute('npm test');
} catch (e) {
console.log('Failing: ', e.toString());
process.exit(1);
}
process.chdir('..');
}

function test_downstream(projects) {
if (typeof child_process.execSync !== 'function') {
console.log('This only works with Node.js >= 0.12 that support execSync');
process.exit(0);
}

var downstream_path = 'downstream';
if (!fs.existsSync(downstream_path)) {
fs.mkdirSync(downstream_path, 0766);
}
process.chdir(downstream_path);

Object.keys(projects).forEach(function (project) {
test_project(project, projects[project]);
});
}

test_downstream({
'escope': 'https://github.com/estools/escope.git',
'escodegen': 'https://github.com/estools/escodegen.git',
'escomplex-js': 'https://github.com/philbooth/escomplex-js.git',
'istanbul': 'https://github.com/gotwarlost/istanbul.git'
});

0 comments on commit d896aff

Please sign in to comment.