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

Fix: Removing obsolete warning from undesired snapshots #4009

Closed

Conversation

samkevin1
Copy link
Contributor

@samkevin1 samkevin1 commented Aug 23, 2023

Description

This PR removes the obsolete snapshot warning from skipped suite tests.

Related to #2442.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

@stackblitz
Copy link

stackblitz bot commented Aug 23, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@netlify
Copy link

netlify bot commented Aug 23, 2023

Deploy Preview for fastidious-cascaron-4ded94 ready!

Name Link
🔨 Latest commit bb3b842
🔍 Latest deploy log https://app.netlify.com/sites/fastidious-cascaron-4ded94/deploys/650846b64726750008196370
😎 Deploy Preview https://deploy-preview-4009--fastidious-cascaron-4ded94.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.


getTasks(suite).forEach((suiteTask) => {
if (suiteTask.mode === 'skip') {
getTasks(suiteTask).forEach((task) => {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think there are any tasks here when suite is skipped. We skip collection phase altogether

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Weird, I was logging the tasks and they were there. The warning is also not happening anymore as reported in the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, the tasks are there but they have mode: 'skip'

Copy link
Member

@sheremet-va sheremet-va left a comment

Choose a reason for hiding this comment

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

Can you add more tests? Create a fixture with snapshots and a suite with .skip. You can use test/test-utils/index.ts to run Vitest on the fixture.

Then check that the output doesn't contain an error that there are obsolete snapshots

@samkevin1
Copy link
Contributor Author

@sheremet-va Added the tests, not sure why the CI is failing though.

})
}

describe('snapshot should not be obsolete', () => {
Copy link
Member

Choose a reason for hiding this comment

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

When I run this test without your changes, it gives the same result. Your tests should validate that the change that you made is working.

If you just run this command in main, you can see that there are already no obsolete warnings. Please, create a test that actually tests things.

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.

2 participants