@web/test-runner-core
Advanced tools
Comparing version 0.5.1 to 0.5.2
# @web/test-runner-core | ||
## 0.5.2 | ||
### Patch Changes | ||
- f5eff91: clear timeouts on close | ||
## 0.5.1 | ||
@@ -4,0 +10,0 @@ |
@@ -98,2 +98,3 @@ "use strict"; | ||
this.stopped = true; | ||
this.scheduler.stop(); | ||
this.config.server.stop().catch(error => { | ||
@@ -100,0 +101,0 @@ console.error(error); |
@@ -7,3 +7,7 @@ import { TestRunnerConfig } from './TestRunnerConfig'; | ||
private sessions; | ||
private timeoutIdsPerSession; | ||
constructor(config: TestRunnerConfig, sessions: TestSessionManager); | ||
stop(): void; | ||
private addTimeoutId; | ||
private clearTimeouts; | ||
schedule(testRun: number, sessionsToSchedule: Iterable<TestSession>): Promise<void[]>; | ||
@@ -10,0 +14,0 @@ runScheduled(testRun: number): Promise<void[]>; |
@@ -10,3 +10,28 @@ "use strict"; | ||
this.sessions = sessions; | ||
this.timeoutIdsPerSession = new Map(); | ||
sessions.on('session-status-updated', session => { | ||
const timeoutIds = this.timeoutIdsPerSession.get(session.id); | ||
if (timeoutIds && session.status === TestSessionStatus_1.SESSION_STATUS.FINISHED) { | ||
this.clearTimeouts(timeoutIds); | ||
} | ||
}); | ||
} | ||
stop() { | ||
for (const ids of this.timeoutIdsPerSession.values()) { | ||
this.clearTimeouts(ids); | ||
} | ||
} | ||
addTimeoutId(sessionId, id) { | ||
let timeoutIds = this.timeoutIdsPerSession.get(sessionId); | ||
if (!timeoutIds) { | ||
timeoutIds = []; | ||
this.timeoutIdsPerSession.set(sessionId, timeoutIds); | ||
} | ||
timeoutIds.push(id); | ||
} | ||
clearTimeouts(timeoutIds) { | ||
for (const id of timeoutIds) { | ||
clearTimeout(id); | ||
} | ||
} | ||
async schedule(testRun, sessionsToSchedule) { | ||
@@ -36,3 +61,3 @@ for (const session of sessionsToSchedule) { | ||
// browser should be started within the specified milliseconds | ||
setTimeout(() => { | ||
const timeoutId = setTimeout(() => { | ||
if (!browserStartResponded) { | ||
@@ -44,2 +69,3 @@ this.setSessionFailed(this.sessions.get(session.id), { | ||
}, this.config.browserStartTimeout); | ||
this.addTimeoutId(session.id, timeoutId); | ||
try { | ||
@@ -62,3 +88,3 @@ // TODO: Select associated browser | ||
setSessionStartedTimeout(testRun, sessionId) { | ||
setTimeout(() => { | ||
const timeoutId = setTimeout(() => { | ||
const session = this.sessions.get(sessionId); | ||
@@ -81,5 +107,6 @@ if (session.testRun !== testRun) { | ||
}, this.config.sessionStartTimeout); | ||
this.addTimeoutId(sessionId, timeoutId); | ||
} | ||
setSessionFinishedTimeout(testRun, sessionId) { | ||
setTimeout(() => { | ||
const timeoutId = setTimeout(() => { | ||
const session = this.sessions.get(sessionId); | ||
@@ -96,2 +123,3 @@ if (session.testRun !== testRun) { | ||
}, this.config.sessionFinishTimeout); | ||
this.addTimeoutId(sessionId, timeoutId); | ||
} | ||
@@ -98,0 +126,0 @@ } |
{ | ||
"name": "@web/test-runner-core", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"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
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
61014
753