Skip to content

fix(@schematics/angular): add a TODO for negated arrayWithExactContents in refactor-jasmine-vitest - #34691

Open
MeAkib wants to merge 1 commit into
angular:mainfrom
MeAkib:fix/jasmine-vitest-negated-array-exact-contents
Open

MeAkib wants to merge 1 commit into
angular:mainfrom
MeAkib:fix/jasmine-vitest-negated-array-exact-contents

Conversation

@MeAkib

@MeAkib MeAkib commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

transformArrayWithExactContents splits the assertion into a .toHaveLength() check and a .toEqual(expect.arrayContaining()) check without looking for .not. A negated assertion is split into two negated checks, which asserts that neither condition holds instead of not both: an array with the right length but different contents passes in Jasmine and fails after the migration.

Vitest has no single matcher for exact-contents-in-any-order, so a faithful negation cannot be expressed by splitting. Leave the negated form unchanged and add a TODO comment instead, matching the existing handling of a dynamic (non-literal) argument.

…ts in refactor-jasmine-vitest

`transformArrayWithExactContents` splits the assertion into a
`.toHaveLength()` check and a `.toEqual(expect.arrayContaining())`
check without looking for `.not`. A negated assertion is split into two
negated checks, which asserts that neither condition holds instead of
not both: an array with the right length but different contents passes
in Jasmine and fails after the migration.

Vitest has no single matcher for exact-contents-in-any-order, so a
faithful negation cannot be expressed by splitting. Leave the negated
form unchanged and add a TODO comment instead, matching the existing
handling of a dynamic (non-literal) argument.

The new spec runs the full transform pipeline on a negated assertion;
it fails without this change and `//packages/schematics/angular:test`
passes with it.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request adds handling for negated jasmine.arrayWithExactContents assertions during the Jasmine-to-Vitest migration. It prevents incorrect splitting of negated assertions by adding a TODO comment for manual migration instead. A test case and the corresponding TODO message definition have also been added. I have no feedback to provide as the implementation is clean and correct.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant