Skip to content

test: use forward-slash fixture names in vm-state-snapshot on Windows - #757

Open
jonathanmendoza-tx wants to merge 1 commit into
scratchfoundation:developfrom
jonathanmendoza-tx:fix/vm-state-snapshot-windows-paths
Open

jonathanmendoza-tx wants to merge 1 commit into
scratchfoundation:developfrom
jonathanmendoza-tx:fix/vm-state-snapshot-windows-paths

Conversation

@jonathanmendoza-tx

Copy link
Copy Markdown

Refs #750 path.relative yields backslashes on Windows, forward-slash exclusion list never matched

Resolves

Refs #750 (the vm-state-snapshot comment there). Same class of Windows-only failure as #751, #752 and #753.

Proposed Changes

In packages/scratch-vm/test/integration/vm-state-snapshot.js, the fixture names built from path.relative(...) now go through .replaceAll(path.sep, '/'), with a one-line comment. Fixture names therefore use / on every platform.

replaceAll is used rather than .split(path.sep).join('/') because the split/join form trips the @stylistic/newline-per-chained-call lint rule on a single line. On POSIX path.sep is already /, so Linux and macOS behavior is identical. Snapshot file paths are unaffected, because path.join normalises separators.

Reason for Changes

On Windows, path.relative returns backslash names such as load-extensions\confirm-load\videoSensing-simple-project.sb2. The exclusion list just below is written with forward slashes, so .includes(name) never matches and none of the six excluded fixtures is skipped. They are meant to be skipped because they cause intentional load errors or hang on vm.quit(). Because they run:

  • their snapshots do not exist, which gives ENOENT failures;
  • some hang on vm.quit(), leaving timers alive that then fail unrelated fixtures in the same
    process;
  • the file runs into tap's 30 s timeout.

The test was added in f4cff74. Evaluating the filter directly shows 0 of 6 exclusions matching as written and 6 of 6 once separators are normalized.

Test Coverage

This test file is the coverage. Run on Windows (cmd.exe, Node 24.21.0) in packages/scratch-vm with npx tap test/integration/vm-state-snapshot.js:

  • Before: { total: 206, pass: 174, fail: 32 } in 32.4 s, ending in timeout!, with ENOENT for the six excluded fixtures and leaked-timer failures.
  • After: { total: 117, pass: 117 } in 12.6 s, with no ENOENT, no timer warnings and no timeout.

npm run tap (unit plus integration) gives { total: 3872, pass: 3872 }. ESLint reports 0 errors.

Heads-up for reviewers: on a Windows checkout of current develop, npm test as a whole still fails on a separate format-message lint glob issue, which is #753 and not part of this PR. CI on Linux is unaffected either way, since path.sep is / there.

Refs scratchfoundation#750 path.relative yields backslashes on Windows, forward-slash exclusion list never matched
@jonathanmendoza-tx
jonathanmendoza-tx requested a review from a team as a code owner November 8, 2026 04:09

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant