@web/test-runner-core
Advanced tools
Comparing version 0.6.3 to 0.6.4
# @web/test-runner-core | ||
## 0.6.4 | ||
### Patch Changes | ||
- 5ab18d8: feat(test-runner-core): batch v8 test coverage | ||
## 0.6.3 | ||
@@ -4,0 +10,0 @@ |
@@ -36,3 +36,3 @@ import { CoverageMapData } from 'istanbul-lib-coverage'; | ||
*/ | ||
getTestCoverage?(session: TestSession): undefined | Promise<CoverageMapData | undefined>; | ||
getTestCoverage?(): undefined | Promise<CoverageMapData[] | undefined>; | ||
/** | ||
@@ -39,0 +39,0 @@ * Starts a debug session. This should start a session like startSession, but |
@@ -1,2 +0,2 @@ | ||
import { CoverageSummaryData, CoverageMap } from 'istanbul-lib-coverage'; | ||
import { CoverageSummaryData, CoverageMap, CoverageMapData } from 'istanbul-lib-coverage'; | ||
import { TestSession } from '../test-session/TestSession'; | ||
@@ -10,3 +10,3 @@ import { CoverageConfig } from '../runner/TestRunnerCoreConfig'; | ||
} | ||
export declare function getTestCoverage(sessions: Iterable<TestSession>, config?: CoverageConfig): TestCoverage; | ||
export declare function getTestCoverage(browserCoverage: CoverageMapData[], sessions: Iterable<TestSession>, config?: CoverageConfig): TestCoverage; | ||
//# sourceMappingURL=getTestCoverage.d.ts.map |
@@ -67,3 +67,3 @@ "use strict"; | ||
} | ||
function getTestCoverage(sessions, config) { | ||
function getTestCoverage(browserCoverage, sessions, config) { | ||
const coverageMap = istanbul_lib_coverage_1.createCoverageMap(); | ||
@@ -73,2 +73,3 @@ const coverages = Array.from(sessions) | ||
.filter(c => c); | ||
coverages.push(...browserCoverage); | ||
addingMissingCoverageBranches(coverages); | ||
@@ -75,0 +76,0 @@ for (const coverage of coverages) { |
@@ -27,5 +27,7 @@ import { TestRunnerCoreConfig } from './TestRunnerCoreConfig'; | ||
stopped: boolean; | ||
running: boolean; | ||
focusedTestFile: string | undefined; | ||
private browserLaunchers; | ||
private scheduler; | ||
private pendingSessions; | ||
constructor(config: TestRunnerCoreConfig, testFiles: string[]); | ||
@@ -32,0 +34,0 @@ start(): Promise<void>; |
@@ -22,2 +22,4 @@ "use strict"; | ||
this.stopped = false; | ||
this.running = false; | ||
this.pendingSessions = new Set(); | ||
this.config = config; | ||
@@ -80,5 +82,12 @@ this.testFiles = testFiles.map(f => path_1.resolve(f)); | ||
} | ||
if (this.running) { | ||
for (const session of sessions) { | ||
this.pendingSessions.add(session); | ||
} | ||
return; | ||
} | ||
const sessionsToRun = this.focusedTestFile | ||
? Array.from(sessions).filter(f => f.testFile === this.focusedTestFile) | ||
: Array.from(sessions); | ||
: [...sessions, ...this.pendingSessions]; | ||
this.pendingSessions.clear(); | ||
if (sessionsToRun.length === 0) { | ||
@@ -89,2 +98,3 @@ return; | ||
this.testRun += 1; | ||
this.running = true; | ||
await this.scheduler.schedule(this.testRun, sessionsToRun); | ||
@@ -94,2 +104,3 @@ this.emit('test-run-started', { testRun: this.testRun, sessions: sessionsToRun }); | ||
catch (error) { | ||
this.running = false; | ||
this.quit(error); | ||
@@ -139,2 +150,3 @@ } | ||
async onSessionFinished(session) { | ||
var _a; | ||
try { | ||
@@ -148,3 +160,10 @@ session.browserLauncher.stopSession(session); | ||
if (this.config.coverage) { | ||
testCoverage = getTestCoverage_1.getTestCoverage(this.sessions.all(), this.config.coverageConfig); | ||
const rawBrowserCoverage = []; | ||
for (const launcher of this.browserLaunchers) { | ||
const coverage = await ((_a = launcher.getTestCoverage) === null || _a === void 0 ? void 0 : _a.call(launcher)); | ||
if (coverage) { | ||
rawBrowserCoverage.push(...coverage); | ||
} | ||
} | ||
testCoverage = getTestCoverage_1.getTestCoverage(rawBrowserCoverage, this.sessions.all(), this.config.coverageConfig); | ||
passedCoverage = testCoverage.passed; | ||
@@ -156,2 +175,6 @@ } | ||
this.emit('test-run-finished', { testRun: this.testRun, testCoverage }); | ||
this.running = false; | ||
if (this.pendingSessions) { | ||
this.runTests(this.pendingSessions); | ||
} | ||
}); | ||
@@ -158,0 +181,0 @@ if (!this.config.watch) { |
{ | ||
"name": "@web/test-runner-core", | ||
"version": "0.6.3", | ||
"version": "0.6.4", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69978
845