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

[RFC]: Replace the snapshot tests with more meaningful code #1154

Open
2 tasks
KnisterPeter opened this issue Apr 20, 2020 · 0 comments
Open
2 tasks

[RFC]: Replace the snapshot tests with more meaningful code #1154

KnisterPeter opened this issue Apr 20, 2020 · 0 comments

Comments

@KnisterPeter
Copy link
Contributor

Reason

Right now the snapshot test does not run on windows, because the path matching in the normalize helper fails to match for windows paths.

The details in the normalizer work on all strings matching a base path. This needs to convert backslashes as well and not only remove the common base path.

Problem

I think a few things about this are awkward:

  1. Replacing strings by regexp in a serialized json object could match other things and not only paths.
  2. Converting all backslashes for 'kind-of'-paths is not that easy and would increase complexity a lot
  3. This is 'patching' the test results before snapshoting them. This means to create code for just the tests to have them more stable which is contraproductive and could lead to fixing the testcode instead of bugs.
  4. Snapshots per se are more useful to detect if something has changed, but unit tests should be there do define whats expected. Right now the expectation in the untool tests with snapshots is not clear.

Solution

  • Rewrite the tests using snapshots into more explicit tests.
  • Maybe convert the tests to jest instead of use ava since the expect output is somewhat better

Additional info

Moved from untool/untool#480

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

No branches or pull requests

1 participant