Skip to content

test: tolerate duplicate watch change events#63937

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:test-watch-file-shared-dependency
Open

test: tolerate duplicate watch change events#63937
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:test-watch-file-shared-dependency

Conversation

@trivikr

@trivikr trivikr commented Jun 16, 2026

Copy link
Copy Markdown
Member

This deflakes test-watch-file-shared-dependency by allowing the watcher
listener to ignore extra or partial changed events.

fs.watch() can emit more than one event for a single write. The test only
needs to verify that the dependency change eventually reports both owners, but
wrapping the whole listener in common.mustCall() made any additional watcher
event fail the test.

Refs: https://github.com/nodejs/node/actions/runs/27462359210/job/81178399610

Error Log
=== release test-watch-file-shared-dependency ===
Path: parallel/test-watch-file-shared-dependency
Error: --- stdout ---
Mismatched <anonymous> function calls. Expected exactly 1, actual 2.
    at Module.mustCall (/Users/runner/work/node/node/node/test/common/index.js:468:10)
    at TestContext.<anonymous> (file:///Users/runner/work/node/node/node/test/parallel/test-watch-file-shared-dependency.mjs:37:34)
    at Test.runInAsyncScope (node:async_hooks:226:14)
    at Test.run (node:internal/test_runner/test:1369:21)
    at Test.start (node:internal/test_runner/test:1242:17)
    at node:internal/test_runner/test:1867:71
    at node:internal/per_context/primordials:466:82
    at new Promise (<anonymous>)
    at new SafePromise (node:internal/per_context/primordials:435:3)
Command: out/Release/node --expose-internals --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /Users/runner/work/node/node/node/test/parallel/test-watch-file-shared-dependency.mjs

Assisted-by: openai:gpt-5.5

Allow test-watch-file-shared-dependency to observe multiple watcher
events while still asserting that the expected owner set is reached
exactly once.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Jun 16, 2026
@trivikr trivikr added flaky-test Issues and PRs related to the tests with unstable failures on the CI. request-ci Add this label to start a Jenkins CI on a PR. labels Jun 16, 2026

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina added request-ci Add this label to start a Jenkins CI on a PR. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Jun 16, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 16, 2026
@nodejs-github-bot

This comment was marked as outdated.

@trivikr trivikr added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 16, 2026
@nodejs-github-bot

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. flaky-test Issues and PRs related to the tests with unstable failures on the CI. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants