Parallel: run our own specs in parallel
This commit is contained in:
40
Gruntfile.js
40
Gruntfile.js
@@ -30,9 +30,9 @@ module.exports = function(grunt) {
|
||||
function() {
|
||||
verifyNoGlobals(() => require('./lib/jasmine-core.js').noGlobals());
|
||||
const done = this.async(),
|
||||
Jasmine = require('jasmine'),
|
||||
jasmineCore = require('./lib/jasmine-core.js'),
|
||||
jasmine = new Jasmine({jasmineCore: jasmineCore});
|
||||
Jasmine = require('jasmine'),
|
||||
jasmineCore = require('./lib/jasmine-core.js'),
|
||||
jasmine = new Jasmine({jasmineCore: jasmineCore});
|
||||
|
||||
jasmine.loadConfigFile('./spec/support/jasmine.json');
|
||||
jasmine.exitOnCompletion = false;
|
||||
@@ -40,12 +40,44 @@ module.exports = function(grunt) {
|
||||
result => done(result.overallStatus === 'passed'),
|
||||
err => {
|
||||
console.error(err);
|
||||
exit(1);
|
||||
done(false);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
grunt.registerTask("execSpecsInParallel",
|
||||
"Run Jasmine core specs in parallel in Node.js",
|
||||
function() {
|
||||
// Need to require this here rather than at the top of the file
|
||||
// so that we don't break verifyNoGlobals above by loading jasmine-core
|
||||
// too early
|
||||
const ParallelRunner = require('jasmine/parallel');
|
||||
|
||||
console.log('parallel runner pid:', process.pid);
|
||||
const done = this.async();
|
||||
// TODO use this core instead of the one imported by jasmine/parallel
|
||||
// const jasmineCore = require('./lib/jasmine-core.js');
|
||||
const runner = new ParallelRunner({
|
||||
// TODO:
|
||||
// jasmineCore,
|
||||
// numWorkers: require('os').cpus().length
|
||||
});
|
||||
|
||||
runner.loadConfigFile('./spec/support/jasmine.json')
|
||||
.then(() => {
|
||||
runner.exitOnCompletion = false;
|
||||
return runner.execute();
|
||||
}).then(
|
||||
jasmineDoneInfo => done(jasmineDoneInfo.overallStatus === 'passed'),
|
||||
err => {
|
||||
console.error(err);
|
||||
done(false);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
grunt.registerTask("execSpecsInNode:performance",
|
||||
"Run Jasmine performance specs in Node.js",
|
||||
function() {
|
||||
|
||||
@@ -29,7 +29,7 @@ describe('AsyncExpectation', function() {
|
||||
|
||||
it('converts a fail to a pass', function() {
|
||||
const addExpectationResult = jasmine.createSpy('addExpectationResult'),
|
||||
actual = Promise.reject(),
|
||||
actual = Promise.reject(new Error('nope')),
|
||||
expectation = jasmineUnderTest.Expectation.asyncFactory({
|
||||
matchersUtil: new jasmineUnderTest.MatchersUtil({
|
||||
pp: function() {}
|
||||
@@ -138,7 +138,7 @@ describe('AsyncExpectation', function() {
|
||||
}
|
||||
},
|
||||
addExpectationResult = jasmine.createSpy('addExpectationResult'),
|
||||
actual = Promise.reject(),
|
||||
actual = Promise.reject(new Error('nope')),
|
||||
expectation = jasmineUnderTest.Expectation.asyncFactory({
|
||||
actual: actual,
|
||||
addExpectationResult: addExpectationResult,
|
||||
|
||||
@@ -145,7 +145,7 @@ describe('base helpers', function() {
|
||||
});
|
||||
|
||||
it('returns a promise that resolves to false when the promise is rejected', function() {
|
||||
const promise = Promise.reject();
|
||||
const promise = Promise.reject(new Error('nope'));
|
||||
return expectAsync(jasmineUnderTest.isPending_(promise)).toBeResolvedTo(
|
||||
false
|
||||
);
|
||||
|
||||
@@ -349,7 +349,7 @@ describe('Matchers (Integration)', function() {
|
||||
});
|
||||
|
||||
verifyFailsAsync(function(env) {
|
||||
return env.expectAsync(Promise.reject()).toBeResolved();
|
||||
return env.expectAsync(Promise.reject(new Error('nope'))).toBeResolved();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user