fix(@schematics/angular): transform fail() to expect.fail() in refactor-jasmine-vitest - #33865
Open
clydin wants to merge 1 commit into
Open
fix(@schematics/angular): transform fail() to expect.fail() in refactor-jasmine-vitest#33865clydin wants to merge 1 commit into
clydin wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the Jasmine-to-Vitest transformer to convert Jasmine's fail() calls to Vitest's expect.fail() instead of throwing a new Error, and ensures expect is imported when needed. The feedback highlights that expect.fail() in Vitest/Chai only accepts a string argument, meaning passing an Error object directly will cause TypeScript compilation errors. It is recommended to extract the string message from Error instantiations and wrap non-string arguments in String() to ensure type safety, updating the corresponding unit and integration tests accordingly.
…or-jasmine-vitest Previously, fail() calls in Jasmine specs were transformed into throw new Error(...). In Vitest, expect.fail(...) is the idiomatic assertion method to explicitly fail a test with an AssertionError, properly formatting test failures in test runner output and avoiding generic unhandled exception throws. This update converts fail(...) call expressions to expect.fail(...), registers expect in the pending Vitest value imports, and moves the transformer into the call expression transformers pipeline.
clydin
force-pushed
the
fix-vitest-fail-refactor
branch
from
August 14, 2026 18:03
fa2827b to
2724099
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, fail() calls in Jasmine specs were transformed into throw new Error(...). In Vitest, expect.fail(...) is the idiomatic assertion method to explicitly fail a test with an AssertionError, properly formatting test failures in test runner output and avoiding generic unhandled exception throws.
This update converts fail(...) call expressions to expect.fail(...), registers expect in the pending Vitest value imports, and moves the transformer into the call expression transformers pipeline.