Skip to content
This repository was archived by the owner on Sep 19, 2025. It is now read-only.

Commit c19bc4e

Browse files
Merge pull request #257 from google/java-only-tests
Add a --java-only flag to allow only the java tests to be run
2 parents 927d259 + d4b1f01 commit c19bc4e

File tree

3 files changed

+36
-16
lines changed

3 files changed

+36
-16
lines changed

packages/google-closure-compiler/test/cli.js

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ const should = require('should');
2626
const runCommand = require('../../../build-scripts/run-command');
2727
require('mocha');
2828

29+
const javaOnly = process.argv.find((arg) => arg == '--java-only');
30+
const platforms = ['java'];
31+
if (!javaOnly) {
32+
platforms.push('native');
33+
}
34+
2935
process.on('unhandledRejection', e => { throw e; });
3036

3137
describe('command line interface', function() {
@@ -37,21 +43,23 @@ describe('command line interface', function() {
3743
cliPath = `node ${cliPath}`;
3844
}
3945

40-
it('chooses an acceptable platform automatically', done => {
41-
function complete(arg) {
42-
should(arg).not.be.instanceof(Error);
43-
const {stdout, sderr, exitCode} = arg;
44-
should(exitCode).equal(0);
45-
should(stdout.length).above(0);
46-
done();
47-
}
48-
49-
runCommand(`${cliPath} --js test/fixtures/one.js`, {stdio: 'pipe'})
50-
.then(complete)
51-
.catch(complete);
52-
});
46+
if (!javaOnly) {
47+
it('chooses an acceptable platform automatically', done => {
48+
function complete(arg) {
49+
should(arg).not.be.instanceof(Error);
50+
const {stdout, sderr, exitCode} = arg;
51+
should(exitCode).equal(0);
52+
should(stdout.length).above(0);
53+
done();
54+
}
55+
56+
runCommand(`${cliPath} --js test/fixtures/one.js`, {stdio: 'pipe'})
57+
.then(complete)
58+
.catch(complete);
59+
});
60+
}
5361

54-
['java', 'native'].forEach(platform => {
62+
platforms.forEach(platform => {
5563
describe(`${platform} version`, function() {
5664
it('--help flag', done => {
5765
function complete(arg) {

packages/google-closure-compiler/test/grunt.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ require('mocha');
3030

3131
process.on('unhandledRejection', e => { throw e; });
3232

33+
const javaOnly = process.argv.find((arg) => arg == '--java-only');
34+
const platforms = ['java'];
35+
if (!javaOnly) {
36+
platforms.push('native');
37+
}
38+
3339
const assertNoError = new should.Assertion('grunt');
3440
assertNoError.params = {
3541
operator: 'should not fail with an error',
@@ -125,7 +131,7 @@ describe('grunt-google-closure-compiler', function() {
125131
Object.defineProperty(ClosureCompiler.prototype, 'run', originalCompilerRunMethod);
126132
});
127133

128-
['java', 'native'].forEach(platform => {
134+
platforms.forEach(platform => {
129135
describe(`${platform} version`, function() {
130136
let closureCompiler;
131137
this.slow(10000);

packages/google-closure-compiler/test/gulp.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ const streamFilter = require('gulp-filter');
3333

3434
require('mocha');
3535

36+
const javaOnly = process.argv.find((arg) => arg == '--java-only');
37+
const platforms = ['java'];
38+
if (!javaOnly) {
39+
platforms.push('native');
40+
}
41+
3642
process.on('unhandledRejection', e => { throw e; });
3743

3844
describe('gulp-google-closure-compiler', function() {
@@ -58,7 +64,7 @@ describe('gulp-google-closure-compiler', function() {
5864
Object.defineProperty(ClosureCompiler.prototype, 'run', originalCompilerRunMethod);
5965
});
6066

61-
['java', 'native'].forEach(platform => {
67+
platforms.forEach(platform => {
6268
describe(`${platform} version`, function() {
6369
const closureCompiler = compilerPackage.gulp();
6470

0 commit comments

Comments
 (0)