test: the test suite exits on its own, without --forceExit (closes #585)
Some tests left timers running when they ended, and --forceExit hid them. - Six background test files leave an approval pending, so the background's 20-second timer ran forever. Each file now stubs that timer, as two blocks in tests/backgroundApproval.test.js already did. - Five popup test files show a flash message, and its timer outlived the test. They now run on fake timers. Both test scripts in package.json drop --forceExit. Model: opus-5-5
This commit is contained in:
@@ -56,7 +56,18 @@ async function settle() {
|
||||
for (let i = 0; i < 50; i++) await Promise.resolve();
|
||||
}
|
||||
|
||||
// While an approval is pending, the background starts a 20-second timer to
|
||||
// keep itself running. The timer is stubbed and never starts, so no test in
|
||||
// this file leaves it running.
|
||||
let keepRunningTimer;
|
||||
beforeEach(() => {
|
||||
keepRunningTimer = jest
|
||||
.spyOn(global, "setInterval")
|
||||
.mockImplementation(() => 1);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
keepRunningTimer.mockRestore();
|
||||
delete global.chrome;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user