Skip to content

Remove deprecated helpers and fix release script - #2128

Merged
jaylinski merged 3 commits into
handlebars-lang:masterfrom
kibertoad:fix/deprecated-helpers
Mar 3, 2026
Merged

Remove deprecated helpers and fix release script#2128
jaylinski merged 3 commits into
handlebars-lang:masterfrom
kibertoad:fix/deprecated-helpers

Conversation

@kibertoad

Copy link
Copy Markdown
Contributor
  • Replace deprecated test helpers with idiomatic vitest assertions
  • Fix "Release to AWS" workflow

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 Vitest expect(...) assertions.
  • Remove deprecated global helpers from spec/env/common.js and corresponding ESLint globals.
  • Reorder publish:aws to run grunt before test: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.

Comment thread spec/compiler.js
false,
'Statement must throw exception. This line should not be executed.'
);
expect.unreachable('Statement must throw exception');

Copilot AI Mar 3, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.

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.

@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.

Comment thread spec/compiler.js
false,
'Statement must throw exception. This line should not be executed.'
);
expect.unreachable('Statement must throw exception');

Copilot AI Mar 3, 2026

Copy link

Choose a reason for hiding this comment

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

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(...)).

Copilot uses AI. Check for mistakes.
@jaylinski

Copy link
Copy Markdown
Member

Fix "Release to AWS" workflow

In case you wondered why this will still fail: there is some problem with the AWS token permissions. I think @nknapp has access to the S3 bucket and could fix the token error.

We should probably also update and merge #2020.

@jaylinski
jaylinski merged commit 169ef75 into handlebars-lang:master Mar 3, 2026
13 checks passed
@kibertoad

Copy link
Copy Markdown
Contributor Author

We should probably also update and merge #2020.

I can take a look at it if/after I get permissions to push into other people's branches, would be much easier.

@trivikr

trivikr commented Mar 12, 2026

Copy link
Copy Markdown

I've updated #2020 if you want to take a look.

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.

4 participants