Skip to content

Commit

Permalink
Force server tests to exist promptly
Browse files Browse the repository at this point in the history
  • Loading branch information
habdelra committed Jan 7, 2025
1 parent 8a17e3c commit 072ab4a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/realm-server/tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,29 @@ import './queue-test';
import './realm-server-test';
import './virtual-network-test';
import './billing-test';

// There is some timer that is preventing the node process from ending promptly.
// This forces the test to end with the correct response code. Note than a
// message "Error: Process exited before tests finished running" will be
// displayed because of this approach.
import QUnit from 'qunit';
(QUnit as any).on(
'runEnd',
({
testCounts,
}: {
testCounts: {
passed: number;
failed: number;
total: number;
skipped: number;
todo: number;
};
}) => {
if (testCounts.failed > 0) {
process.exit(1);
} else {
process.exit(0);
}
},
);

0 comments on commit 072ab4a

Please sign in to comment.