mirror of
https://github.com/sasjs/adapter.git
synced 2026-06-08 18:20:20 +00:00
fix(webjob): test coverage for _executionTasks=true requests without file upload (#883)
* test(cypress): show individual errors * test(cypress): half the cypress integration test timeout * test(cypress): add parallel tests, timeout and reports * test(cypress): use allSettled instead of all * test(runner): pre-render pending test cards
This commit is contained in:
committed by
GitHub
parent
eb1186b4b9
commit
55db8f45ab
@@ -30,12 +30,14 @@ export class TestRunner {
|
||||
) => void
|
||||
): Promise<CompletedTestSuite[]> {
|
||||
this.isRunning = true
|
||||
this.completedTestSuites = []
|
||||
this.completedTestSuites = this.testSuites.map((suite) => ({
|
||||
name: suite.name,
|
||||
completedTests: []
|
||||
}))
|
||||
|
||||
for (let i = 0; i < this.testSuites.length; i++) {
|
||||
const suite = this.testSuites[i]
|
||||
await this.runTestSuite(suite, i, onUpdate)
|
||||
}
|
||||
await Promise.allSettled(
|
||||
this.testSuites.map((suite, i) => this.runTestSuite(suite, i, onUpdate))
|
||||
)
|
||||
|
||||
this.isRunning = false
|
||||
return this.completedTestSuites
|
||||
@@ -49,7 +51,23 @@ export class TestRunner {
|
||||
currentIndex: number
|
||||
) => void
|
||||
): Promise<CompletedTestSuite> {
|
||||
const completedTests: CompletedTest[] = []
|
||||
// Seed all tests as pending so every card renders before any run starts.
|
||||
const completedTests: CompletedTest[] = suite.tests.map((test) => ({
|
||||
test,
|
||||
result: false,
|
||||
error: null,
|
||||
executionTime: 0,
|
||||
status: 'pending'
|
||||
}))
|
||||
|
||||
if (onUpdate) {
|
||||
this.completedTestSuites[suiteIndex] = {
|
||||
name: suite.name,
|
||||
completedTests: [...completedTests]
|
||||
}
|
||||
onUpdate([...this.completedTestSuites], suiteIndex * 1000)
|
||||
}
|
||||
|
||||
let context: unknown
|
||||
|
||||
// Run beforeAll if exists
|
||||
@@ -62,15 +80,14 @@ export class TestRunner {
|
||||
const test = suite.tests[i]
|
||||
const currentIndex = suiteIndex * 1000 + i
|
||||
|
||||
// Set status to running
|
||||
const runningTest: CompletedTest = {
|
||||
// Flip pending → running
|
||||
completedTests[i] = {
|
||||
test,
|
||||
result: false,
|
||||
error: null,
|
||||
executionTime: 0,
|
||||
status: 'running'
|
||||
}
|
||||
completedTests.push(runningTest)
|
||||
|
||||
// Notify update
|
||||
if (onUpdate) {
|
||||
|
||||
Reference in New Issue
Block a user