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
This commit is contained in:
Igor Minar 2015-04-24 10:15:52 -07:00
parent b111ca9471
commit 32c5ab956c
5 changed files with 58 additions and 0 deletions

View File

@ -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

View File

@ -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"
},

17
npm-shrinkwrap.json generated
View File

@ -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",

View File

@ -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",

View File

@ -13,6 +13,9 @@
},
"es6-promise/es6-promise.d.ts": {
"commit": "d5f92f93bdb49f332fa662ff1d0cc8700f02e4dc"
},
"jasmine/jasmine.d.ts": {
"commit": "055b3172e8eb374a75826710c4d08677872620d3"
}
}
}