Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip ng-reflect-* and ng-version in snapshots #1475

Open
1 of 2 tasks
k3nsei opened this issue Dec 5, 2024 · 2 comments
Open
1 of 2 tasks

Strip ng-reflect-* and ng-version in snapshots #1475

k3nsei opened this issue Dec 5, 2024 · 2 comments
Labels
2.0 enhancement New feature or request

Comments

@k3nsei
Copy link

k3nsei commented Dec 5, 2024

Which scope/s are relevant/related to the feature request?

vitest-angular

Information

When switched to Istanbul from V8 as coverage provider our tests stopped passing.
Vitest started generating different snapshots when one of component gets function as its input.

Describe any alternatives/workarounds you're currently using

Don't try serialize functions when creating snapshots

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@k3nsei k3nsei added the enhancement New feature or request label Dec 5, 2024
@brandonroberts
Copy link
Member

Thanks @k3nsei. You can try this out manually if you still have jest-preset-angular installed.

Add this to the vite.config.ts:

    test: {
      // .. other config
      snapshotSerializers: [
        'jest-preset-angular/build/serializers/no-ng-attributes'
      ]
    },

We'll look at supporting this in the package itself.

@k3nsei
Copy link
Author

k3nsei commented Dec 6, 2024

I tried the things described here https://marmicode.io/blog/angular-template-code-coverage-and-future-proof-testing and found inconsistent behaviour, resulting in a different snapshot on each test run. So I'm reporting this and asking for a new feature. In my project, I have switched back to V8 as the coverage provider because I cannot leave the project with a broken test suite. I'm seeing a lot of power and new capabilities in Vitest. It will take some time for the integration to mature. But the future looks bright.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.0 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants