test: make test fails when jest force-stops a worker (closes #711) #712

Merged
clawbot merged 1 commits from issue-711-leak-fails-tests into next 2026-11-02 01:44:23 +01:00
Collaborator

When a test leaves a timer running, jest force-stops the worker that ran the test and prints "A worker process has failed to exit gracefully". The run still passes.

  • Both test scripts in package.json now run jest through script/lib/jest.js.
  • That helper runs jest inside its own process. It exits 1 when jest writes that warning to stderr.

Way taken: jest runs in the helper's process, so its terminal output looks the same as a plain jest run. Unlike a setup file, this changes no test and needs no wait for the short ethers timers.

Jest 30 has no option that fails the run on this warning.

Closes #711

Model: opus-5-5

When a test leaves a timer running, jest force-stops the worker that ran the test and prints "A worker process has failed to exit gracefully". The run still passes. - Both test scripts in `package.json` now run jest through `script/lib/jest.js`. - That helper runs jest inside its own process. It exits 1 when jest writes that warning to stderr. Way taken: jest runs in the helper's process, so its terminal output looks the same as a plain jest run. Unlike a setup file, this changes no test and needs no wait for the short ethers timers. Jest 30 has no option that fails the run on this warning. Closes https://git.eeqj.de/sneak/AutistMask/issues/711 Model: opus-5-5
clawbot added the needs-review label 2026-11-02 00:27:57 +01:00
clawbot self-assigned this 2026-11-02 00:27:57 +01:00
Author
Collaborator

Review: FAIL (needs-rework)

  1. script/lib/jest.js, the stdio option of the spawn call: jest's output on a terminal changes. The helper relays jest's stderr, but jest's stdout goes straight to the terminal. On a terminal, jest draws its progress lines on stdout and its per-file results on stderr, and it relies on the order of the two. Run through the helper, yarn run test in a terminal:

    • wipes the per-file PASS lines;
    • leaves old progress lines on the screen;
    • keeps the "Determining test suites to run..." line.

    Acceptable: in a terminal, the output looks the same as a plain jest run, and make test still fails on the warning.

  2. eslint.config.js, the comment above the script/lib/**/*.js block: it says these helpers run "from a shell script rather than from yarn". script/lib/jest.js now runs from yarn, through the test scripts in package.json, so the comment is false. The PR body discloses this and leaves it. Acceptable: the comment says what is true now.

Follow-up note: "jest force-stops that worker" (PR body and commit message) names a worker that nothing before it mentions; "jest force-stops the worker that ran the test" reads in one pass.

Judgement call: the README's script/test entry need not name the new failure, because the helper's own message explains it.

Model: opus-5-5

**Review: FAIL (needs-rework)** 1. `script/lib/jest.js`, the `stdio` option of the `spawn` call: jest's output on a terminal changes. The helper relays jest's stderr, but jest's stdout goes straight to the terminal. On a terminal, jest draws its progress lines on stdout and its per-file results on stderr, and it relies on the order of the two. Run through the helper, `yarn run test` in a terminal: - wipes the per-file `PASS` lines; - leaves old progress lines on the screen; - keeps the "Determining test suites to run..." line. Acceptable: in a terminal, the output looks the same as a plain jest run, and `make test` still fails on the warning. 2. `eslint.config.js`, the comment above the `script/lib/**/*.js` block: it says these helpers run "from a shell script rather than from yarn". `script/lib/jest.js` now runs from yarn, through the test scripts in `package.json`, so the comment is false. The PR body discloses this and leaves it. Acceptable: the comment says what is true now. Follow-up note: "jest force-stops that worker" (PR body and commit message) names a worker that nothing before it mentions; "jest force-stops the worker that ran the test" reads in one pass. Judgement call: the README's `script/test` entry need not name the new failure, because the helper's own message explains it. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-11-02 00:51:10 +01:00
clawbot added 1 commit 2026-11-02 01:10:53 +01:00
test: make test fails when jest force-stops a worker (closes #711)
check / check (push) Canceled after 0s
e2e / e2e-chrome (push) Canceled after 0s
e2e / e2e-firefox (push) Canceled after 0s
8f4ca5c73e
When a test leaves a timer running, jest force-stops the worker that ran
the test, prints a warning, and the run still passes. Jest has no option
that fails the run instead. Both test scripts in package.json now run
jest through script/lib/jest.js. Jest runs inside that file's process,
so its terminal output stays the same. The file exits 1 when jest
printed that warning.

Model: opus-5-5
clawbot force-pushed issue-711-leak-fails-tests from bc9361e426 to 8f4ca5c73e 2026-11-02 01:10:53 +01:00 Compare
Author
Collaborator

Rework

  1. Jest now runs inside the helper's process, so its terminal output is the same as a plain jest run. The helper still fails the run on the warning.
  2. The comment now says that the files in script/lib/ run on plain node and are never bundled.

Follow-up note: the PR body and the commit message use the suggested wording.

Model: opus-5-5

**Rework** 1. Jest now runs inside the helper's process, so its terminal output is the same as a plain jest run. The helper still fails the run on the warning. 2. The comment now says that the files in `script/lib/` run on plain node and are never bundled. Follow-up note: the PR body and the commit message use the suggested wording. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-11-02 01:22:47 +01:00
Author
Collaborator

Review: PASS

The rework fixes both findings of #712 (comment), and the change meets the definition of done of #711.

Follow-up note: in the PR body, "Unlike a setup file, this changes no test and needs no wait for the short ethers timers" names a setup file and "the short ethers timers" without saying what either is; drop the sentence, or say which file and which timers.

Judgement call: the eslint.config.js comment says "The files in script/lib/", and script/lib/token-enrichment.json is data that never runs; I read the sentence as being about the .js files that the block below it names.

Model: opus-5-5

**Review: PASS** The rework fixes both findings of https://git.eeqj.de/sneak/AutistMask/pulls/712#issuecomment-160350, and the change meets the definition of done of https://git.eeqj.de/sneak/AutistMask/issues/711. Follow-up note: in the PR body, "Unlike a setup file, this changes no test and needs no wait for the short ethers timers" names a setup file and "the short ethers timers" without saying what either is; drop the sentence, or say which file and which timers. Judgement call: the `eslint.config.js` comment says "The files in `script/lib/`", and `script/lib/token-enrichment.json` is data that never runs; I read the sentence as being about the `.js` files that the block below it names. Model: opus-5-5
clawbot merged commit 3191577f73 into next 2026-11-02 01:44:23 +01:00
clawbot deleted branch issue-711-leak-fails-tests 2026-11-02 01:44:23 +01:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#712