Added a parallel flag to the jasmineStarted reporter event

This commit is contained in:
Steve Gravrock
2023-03-03 20:49:10 -08:00
parent cbc03feb52
commit 8af5509581
3 changed files with 19 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/* /*
Copyright (c) 2008-2022 Pivotal Labs Copyright (c) 2008-2023 Pivotal Labs
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the
@@ -8619,11 +8619,15 @@ getJasmineRequireObj().Runner = function(j$) {
* @typedef JasmineStartedInfo * @typedef JasmineStartedInfo
* @property {Int} totalSpecsDefined - The total number of specs defined in this suite. Note that this property is not present when Jasmine is run in parallel mode. * @property {Int} totalSpecsDefined - The total number of specs defined in this suite. Note that this property is not present when Jasmine is run in parallel mode.
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite. Note that this property is not present when Jasmine is run in parallel mode. * @property {Order} order - Information about the ordering (random or not) of this execution of the suite. Note that this property is not present when Jasmine is run in parallel mode.
* @property {Boolean} parallel - Whether Jasmine is being run in parallel mode.
* @since 2.0.0 * @since 2.0.0
*/ */
await this.reporter_.jasmineStarted({ await this.reporter_.jasmineStarted({
// In parallel mode, the jasmineStarted event is separately dispatched
// by jasmine-npm. This event only reaches reporters in non-parallel.
totalSpecsDefined, totalSpecsDefined,
order: order order: order,
parallel: false
}); });
this.currentlyExecutingSuites_.push(this.topSuite_); this.currentlyExecutingSuites_.push(this.topSuite_);

View File

@@ -1888,7 +1888,8 @@ describe('Env integration', function() {
expect(reporter.jasmineStarted).toHaveBeenCalledWith({ expect(reporter.jasmineStarted).toHaveBeenCalledWith({
totalSpecsDefined: 1, totalSpecsDefined: 1,
order: jasmine.any(jasmineUnderTest.Order) order: jasmine.any(jasmineUnderTest.Order),
parallel: false
}); });
expect(reporter.specDone).toHaveBeenCalledWith( expect(reporter.specDone).toHaveBeenCalledWith(
@@ -1922,7 +1923,8 @@ describe('Env integration', function() {
expect(reporter.jasmineStarted).toHaveBeenCalledWith({ expect(reporter.jasmineStarted).toHaveBeenCalledWith({
totalSpecsDefined: 1, totalSpecsDefined: 1,
order: jasmine.any(jasmineUnderTest.Order) order: jasmine.any(jasmineUnderTest.Order),
parallel: false
}); });
expect(reporter.specDone).toHaveBeenCalledWith( expect(reporter.specDone).toHaveBeenCalledWith(
@@ -1970,7 +1972,8 @@ describe('Env integration', function() {
expect(reporter.jasmineStarted).toHaveBeenCalledWith({ expect(reporter.jasmineStarted).toHaveBeenCalledWith({
totalSpecsDefined: 5, totalSpecsDefined: 5,
order: jasmine.any(jasmineUnderTest.Order) order: jasmine.any(jasmineUnderTest.Order),
parallel: false
}); });
expect(reporter.specDone.calls.count()).toBe(5); expect(reporter.specDone.calls.count()).toBe(5);
@@ -2152,7 +2155,8 @@ describe('Env integration', function() {
expect(reporter.jasmineStarted).toHaveBeenCalledWith({ expect(reporter.jasmineStarted).toHaveBeenCalledWith({
totalSpecsDefined: 1, totalSpecsDefined: 1,
order: jasmine.any(jasmineUnderTest.Order) order: jasmine.any(jasmineUnderTest.Order),
parallel: false
}); });
expect(reporter.specDone).toHaveBeenCalledWith( expect(reporter.specDone).toHaveBeenCalledWith(

View File

@@ -129,11 +129,15 @@ getJasmineRequireObj().Runner = function(j$) {
* @typedef JasmineStartedInfo * @typedef JasmineStartedInfo
* @property {Int} totalSpecsDefined - The total number of specs defined in this suite. Note that this property is not present when Jasmine is run in parallel mode. * @property {Int} totalSpecsDefined - The total number of specs defined in this suite. Note that this property is not present when Jasmine is run in parallel mode.
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite. Note that this property is not present when Jasmine is run in parallel mode. * @property {Order} order - Information about the ordering (random or not) of this execution of the suite. Note that this property is not present when Jasmine is run in parallel mode.
* @property {Boolean} parallel - Whether Jasmine is being run in parallel mode.
* @since 2.0.0 * @since 2.0.0
*/ */
await this.reporter_.jasmineStarted({ await this.reporter_.jasmineStarted({
// In parallel mode, the jasmineStarted event is separately dispatched
// by jasmine-npm. This event only reaches reporters in non-parallel.
totalSpecsDefined, totalSpecsDefined,
order: order order: order,
parallel: false
}); });
this.currentlyExecutingSuites_.push(this.topSuite_); this.currentlyExecutingSuites_.push(this.topSuite_);