Remove deprecated helpers and fix release script - #2128
Conversation
kibertoad
commented
Mar 2, 2026
- Replace deprecated test helpers with idiomatic vitest assertions
- Fix "Release to AWS" workflow
There was a problem hiding this comment.
Pull request overview
This PR modernizes the test suite by removing deprecated global test helpers in favor of Vitest’s expect API, and adjusts the AWS publish script ordering to better align with the build/release flow.
Changes:
- Replace deprecated
equal/equals/shouldThrow/shouldCompileTo*helpers across specs with idiomatic Vitestexpect(...)assertions. - Remove deprecated global helpers from
spec/env/common.jsand corresponding ESLint globals. - Reorder
publish:awsto rungruntbeforetest:tasks, then publish.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/utils.js | Replaces deprecated equality helper usage with expect(...).toBe(...). |
| spec/tokenizer.js | Updates local assertion helpers to use Vitest expect. |
| spec/strict.js | Migrates strict-mode assertions to expect, including undefined/property checks. |
| spec/source-map.js | Converts boolean assertions to toBeTruthy/toBeFalsy with browser-aware branching. |
| spec/security.js | Replaces deprecated equality helper with expect(...).toBe(...). |
| spec/runtime.js | Replaces shouldThrow usages with expect(fn).toThrow(...) and updates equality checks. |
| spec/require.js | Converts equal(...) assertions to expect(...).toBe(...) for require-based template loading. |
| spec/regressions.js | Replaces shouldCompileTo usage with expectTemplate(...).withInput(...).withHelpers(...).toCompileTo(...) and updates throw assertions. |
| spec/precompiler.js | Migrates many CLI/precompiler assertions from deprecated helpers to Vitest expect. |
| spec/partials.js | Converts throw/equality assertions to Vitest expect helpers. |
| spec/helpers.js | Updates helper-registration and block param assertions to use expect. |
| spec/env/common.js | Removes deprecated global helper implementations; keeps expectTemplate entry point. |
| spec/compiler.js | Migrates assertions to expect and introduces expect.unreachable in two places (problematic). |
| spec/builtins.js | Removes dependency on removed helper by calling CompilerContext.compile directly; updates assertions. |
| spec/blocks.js | Updates decorator-related tests to use expect assertions and toBeUndefined/toBeTruthy. |
| spec/ast.js | Converts parser/AST helper tests from deprecated helpers to Vitest expect. |
| spec/.eslintrc.js | Removes globals for the deleted deprecated helpers. |
| package.json | Reorders publish:aws steps to run grunt before test:tasks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| false, | ||
| 'Statement must throw exception. This line should not be executed.' | ||
| ); | ||
| expect.unreachable('Statement must throw exception'); |
There was a problem hiding this comment.
expect.unreachable is not part of Vitest's expect API (and there is no local extension in the test setup), so this line will throw "expect.unreachable is not a function" when the try-block doesn't throw as expected. Use a supported failure primitive here (e.g., expect.fail(...) / throw new Error(...)) to ensure the test fails if no exception is thrown.
There was a problem hiding this comment.
@kibertoad As far as I can see @copilot code review[agent] isn't aware of https://vitest.dev/api/expect.html#expect-unreachable. I'll merge it, if this is an issue, you can update it in a follow up PR.
| false, | ||
| 'Statement must throw exception. This line should not be executed.' | ||
| ); | ||
| expect.unreachable('Statement must throw exception'); |
There was a problem hiding this comment.
Same issue as above: expect.unreachable is not a Vitest API and will cause the test to error. Replace with a supported way to fail the test when the expected exception is not thrown (e.g., expect.fail(...) / throw new Error(...)).
I can take a look at it if/after I get permissions to push into other people's branches, would be much easier. |
|
I've updated #2020 if you want to take a look. |