From 32c5ab956c36dff75b32a48eaf3e871b760963e2 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Fri, 24 Apr 2015 10:15:52 -0700 Subject: [PATCH] build(broccoli): add testing infrastructure for our build plugins components: - gulp test.unit.broccoli task - mock-fs for mocking our FS in unit tests - jasmine d.ts file for type checking jasmine lib is provided by minijasmine2 so we don't need to include it explicitly --- gulpfile.js | 26 ++++++++++++++++++++++++++ npm-shrinkwrap.clean.json | 11 +++++++++++ npm-shrinkwrap.json | 17 +++++++++++++++++ package.json | 1 + tools/tsd.json | 3 +++ 5 files changed, 58 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index 894eec0c49..c925a6b934 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -501,6 +501,32 @@ gulp.task('test.unit.cjs', ['build.broccoli.tools'], function (done) { }); }); + +gulp.task('test.unit.broccoli', function(done) { + + function buildAndTest() { + runSequence('build.broccoli.tools', function() { + var doneDeferred = Q.defer(); + var jasmineProcess = fork('./tools/traceur-jasmine', ['dist/broccoli/**/*.spec.js'], { + stdio: 'inherit' + }); + + jasmineProcess.on('close', function (code) { + doneDeferred.resolve(); + }); + + return doneDeferred.promise; + }); + } + + buildAndTest(); + + gulp.watch('tools/broccoli/**', function(event) { + buildAndTest(); + }); + +}); + // ------------------ // server tests // These tests run on the VM on the command-line and are diff --git a/npm-shrinkwrap.clean.json b/npm-shrinkwrap.clean.json index 7007bfd020..5c0f90e5a3 100644 --- a/npm-shrinkwrap.clean.json +++ b/npm-shrinkwrap.clean.json @@ -7997,6 +7997,17 @@ "minimist": { "version": "1.1.1" }, + "mock-fs": { + "version": "2.5.0", + "dependencies": { + "rewire": { + "version": "2.0.1" + }, + "semver": { + "version": "4.3.3" + } + } + }, "node-uuid": { "version": "1.4.3" }, diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 0229f116e1..5f2e33e19a 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -12333,6 +12333,23 @@ "from": "minimist@>=1.1.0 <1.2.0", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.1.1.tgz" }, + "mock-fs": { + "version": "2.5.0", + "from": "mock-fs@>=2.5.0 <3.0.0", + "resolved": "https://registry.npmjs.org/mock-fs/-/mock-fs-2.5.0.tgz", + "dependencies": { + "rewire": { + "version": "2.0.1", + "from": "rewire@>=2.0.0 <2.1.0", + "resolved": "https://registry.npmjs.org/rewire/-/rewire-2.0.1.tgz" + }, + "semver": { + "version": "4.3.3", + "from": "semver@>=4.2.0 <5.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.3.tgz" + } + } + }, "node-uuid": { "version": "1.4.3", "from": "node-uuid@>=1.4.0 <1.5.0", diff --git a/package.json b/package.json index bc33c3c797..48e0e0cc2e 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,7 @@ "minijasminenode2": "^1.0.0", "minimatch": "^2.0.1", "minimist": "1.1.x", + "mock-fs": "^2.5.0", "parse5": "1.3.2", "protractor": "2.0.0", "q": "^1.0.1", diff --git a/tools/tsd.json b/tools/tsd.json index b1bf4ba255..91160746a1 100644 --- a/tools/tsd.json +++ b/tools/tsd.json @@ -13,6 +13,9 @@ }, "es6-promise/es6-promise.d.ts": { "commit": "d5f92f93bdb49f332fa662ff1d0cc8700f02e4dc" + }, + "jasmine/jasmine.d.ts": { + "commit": "055b3172e8eb374a75826710c4d08677872620d3" } } }