Skip to content

Commit

Permalink
fix(NodeTestConductor): exit test suite with open handles
Browse files Browse the repository at this point in the history
  • Loading branch information
ph-fritsche committed Dec 27, 2023
1 parent bd44a50 commit 1bc00ea
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 30 deletions.
28 changes: 13 additions & 15 deletions src/conductor/ChromeTestConductor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,19 @@ import { TestRunner, HttpReporterClient } from "${this.testRunnerModule}"
const fetch = window.fetch.bind(window)
const setTimeout = window.setTimeout.bind(window)
await ((async () => {
await new TestRunner(
new HttpReporterClient(
${JSON.stringify(await this.reporterServer.url)},
fetch,
${JSON.stringify(reporterId)},
),
setTimeout,
).run(
${JSON.stringify(this.setupFiles)},
${JSON.stringify(suiteUrl)},
${filter ? `new RegExp(${JSON.stringify(filter.source)}, ${JSON.stringify(filter.flags)})` : JSON.stringify(undefined)},
${JSON.stringify(this.coverageVar)},
)
})()).then(
await new TestRunner(
new HttpReporterClient(
${JSON.stringify(await this.reporterServer.url)},
fetch,
${JSON.stringify(reporterId)},
),
setTimeout,
).run(
${JSON.stringify(this.setupFiles)},
${JSON.stringify(suiteUrl)},
${filter ? `new RegExp(${JSON.stringify(filter.source)}, ${JSON.stringify(filter.flags)})` : JSON.stringify(undefined)},
${JSON.stringify(this.coverageVar)},
).then(
r => window['${callbackPrefix}-resolve'](String(r)),
r => window['${callbackPrefix}-reject'](r instanceof Error ? r.stack : String(r)),
)
Expand Down
30 changes: 15 additions & 15 deletions src/conductor/NodeTestConductor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,21 @@ const fetch = global.fetch
const exit = process.exit
const setTimeout = global.setTimeout
;(async () => {
await new TestRunner(
new HttpReporterClient(
${JSON.stringify(await this.reporterServer.url)},
fetch,
${JSON.stringify(reporterId)},
),
setTimeout,
).run(
${JSON.stringify(this.setupFiles)},
${JSON.stringify(suiteUrl)},
${filter ? `new RegExp(${JSON.stringify(filter.source)}, ${JSON.stringify(filter.flags)})` : JSON.stringify(undefined)},
${JSON.stringify(this.coverageVar)},
)
})()
await new TestRunner(
new HttpReporterClient(
${JSON.stringify(await this.reporterServer.url)},
fetch,
${JSON.stringify(reporterId)},
),
setTimeout,
).run(
${JSON.stringify(this.setupFiles)},
${JSON.stringify(suiteUrl)},
${filter ? `new RegExp(${JSON.stringify(filter.source)}, ${JSON.stringify(filter.flags)})` : JSON.stringify(undefined)},
${JSON.stringify(this.coverageVar)},
)
exit()
`

const whenClosed = (stream: internal.Readable) => stream.closed ? Promise.resolve() : new Promise(r => stream.on('close', r))
Expand Down

0 comments on commit 1bc00ea

Please sign in to comment.