Skip to content

Fix four failing backend test files in Release CI#349

Merged
rajbos merged 2 commits intomainfrom
copilot/fix-release-workflow-tests
Mar 3, 2026
Merged

Fix four failing backend test files in Release CI#349
rajbos merged 2 commits intomainfrom
copilot/fix-release-workflow-tests

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

Four test files were failing with assertion errors (ERR_ASSERTION) and type errors due to missing vscode mock entries, a missing method invocation, broken JSDOM initialization, and missing HTML content the tests expected.

Changes

vscode-shim-register.ts

  • Added ViewColumn enum (needed by BackendConfigPanel.show())
  • Added Uri.joinPath() static method (needed by renderHtml())

backend-cache-integration.test.ts

  • The "validates cached data" loop was creating a BackendFacade but never invoking computeDailyRollupsFromLocalSessions() — no warnings were ever generated, so all assert.ok(warnings.some(...)) checks failed

backend-configurator.test.ts

  • Set window.__toolkitReady = true in all three JSDOM beforeParse callbacks so waitForToolkit() immediately calls init() and wires up event listeners. Without this, the change event on authMode had no handler.
  • Fixed HTML sanitization regex: the old pattern /toolkit\.js"><\/script>/ matched only src= script tags. The actual HTML uses an inline module script (await import('toolkit.js')), which was left in and caused JSDOM to attempt network fetches:
    // Before (missed inline module script):
    html.replace(/<script type="module"[^>]*toolkit\.js"><\/script>/, '')
    // After (removes all module scripts):
    html.replace(/<script type="module"[\s\S]*?<\/script>/g, '')
  • Changed querySelector('#overview .helper')querySelectorAll(...).some(h => h.includes('Stay Local')) since the matching text is not in the first helper element
  • Added dom.window.close() after each JSDOM test's assertions

src/backend/configPanel.ts

  • Added a "Stay Local" helper paragraph to the overview section — the test expected this copy to exist there
Original prompt

The CI workflow 'Release' is failing due to test failures. The following tests fail with errors such as 'Expected values to be strictly equal' and 'The expression evaluated to a falsy value':

  • out/test/test-node/backend-commands.test.js
  • out/test/test-node/backend-copyConfig.test.js
  • out/test/test-node/backend-configurator.test.js
  • out/test/test-node/backend-cache-integration.test.js

Tasks:

  1. Review each failing test and the corresponding implementation code.
  2. Update code or tests as necessary to ensure all assertions pass, matching expected and actual values appropriately.
  3. Ensure all required mocks, test data, and conditions are up to date.
  4. Re-run tests to verify that the failures have been resolved.

Goal: The 'Release' workflow should complete successfully without test failures.

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…and JSDOM setup, Stay Local copy

Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing tests in release workflow Fix four failing backend test files in Release CI Mar 3, 2026
@rajbos rajbos marked this pull request as ready for review March 3, 2026 14:55
@rajbos rajbos enabled auto-merge March 3, 2026 14:56
@rajbos rajbos merged commit b26fc89 into main Mar 3, 2026
12 checks passed
@rajbos rajbos deleted the copilot/fix-release-workflow-tests branch March 3, 2026 14:58
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.

2 participants