-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Output logs for tests that remain pending when AVA exits #3125
Changes from 1 commit
ce2b12e
1937048
98bbc25
29ed720
82231fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -370,8 +370,11 @@ export default class Reporter { | |||||
} | ||||||
|
||||||
this.lineWriter.writeLine(`${testsInFile.size} tests were pending in ${this.relativeFile(file)}\n`); | ||||||
const testTitleToLogs = evt.pendingTestsLogReference.get(file) ?? new Map(); | ||||||
for (const title of testsInFile) { | ||||||
const logs = testTitleToLogs.get(title) ?? []; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
this.lineWriter.writeLine(`${figures.circleDotted} ${this.prefixTitle(file, title)}`); | ||||||
this.writeLogs({logs}); | ||||||
} | ||||||
|
||||||
this.lineWriter.writeLine(''); | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -9,6 +9,7 @@ export default class RunStatus extends Emittery { | |||||||||
super(); | ||||||||||
|
||||||||||
this.pendingTests = new Map(); | ||||||||||
this.pendingTestsLogReference = new Map(); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. separate map from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oops, I think |
||||||||||
|
||||||||||
this.emptyParallelRun = parallelRuns | ||||||||||
&& parallelRuns.currentFileCount === 0 | ||||||||||
|
@@ -60,6 +61,7 @@ export default class RunStatus extends Emittery { | |||||||||
}); | ||||||||||
|
||||||||||
this.pendingTests.set(testFile, new Set()); | ||||||||||
this.pendingTestsLogReference.set(testFile, new Map()); | ||||||||||
worker.onStateChange(data => this.emitStateChange(data)); | ||||||||||
} | ||||||||||
|
||||||||||
|
@@ -124,22 +126,31 @@ export default class RunStatus extends Emittery { | |||||||||
fileStats.remainingTests--; | ||||||||||
this.removePendingTest(event); | ||||||||||
break; | ||||||||||
case 'test-register-log-reference': | ||||||||||
this.addLogReference(event); | ||||||||||
break; | ||||||||||
case 'timeout': | ||||||||||
stats.timeouts++; | ||||||||||
event.pendingTests = this.pendingTests; | ||||||||||
event.pendingTestsLogReference = this.pendingTestsLogReference; | ||||||||||
this.pendingTests = new Map(); | ||||||||||
this.pendingTestsLogReference = new Map(); | ||||||||||
for (const testsInFile of event.pendingTests.values()) { | ||||||||||
stats.timedOutTests += testsInFile.size; | ||||||||||
} | ||||||||||
|
||||||||||
break; | ||||||||||
case 'interrupt': | ||||||||||
event.pendingTests = this.pendingTests; | ||||||||||
event.pendingTestsLogReference = this.pendingTestsLogReference; | ||||||||||
this.pendingTests = new Map(); | ||||||||||
this.pendingTestsLogReference = new Map(); | ||||||||||
break; | ||||||||||
case 'process-exit': | ||||||||||
event.pendingTests = this.pendingTests; | ||||||||||
event.pendingTestsLogReference = this.pendingTestsLogReference; | ||||||||||
this.pendingTests = new Map(); | ||||||||||
this.pendingTestsLogReference = new Map(); | ||||||||||
break; | ||||||||||
case 'uncaught-exception': | ||||||||||
stats.uncaughtExceptions++; | ||||||||||
|
@@ -198,6 +209,12 @@ export default class RunStatus extends Emittery { | |||||||||
return 0; | ||||||||||
} | ||||||||||
|
||||||||||
addLogReference(event) { | ||||||||||
if (this.pendingTestsLogReference.has(event.testFile)) { | ||||||||||
this.pendingTestsLogReference.get(event.testFile).set(event.title, event.logs); | ||||||||||
} | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
} | ||||||||||
|
||||||||||
addPendingTest(event) { | ||||||||||
if (this.pendingTests.has(event.testFile)) { | ||||||||||
this.pendingTests.get(event.testFile).add(event.title); | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.