Skip to content

Fix uvu test pattern #402

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

Merged
merged 4 commits into from
Feb 22, 2021
Merged

Fix uvu test pattern #402

merged 4 commits into from
Feb 22, 2021

Conversation

GrygrFlzr
Copy link
Member

Fixes #401: incorrect test pattern (especially on Windows)

@@ -50,7 +50,7 @@
"format": "prettier --write . --config ../../.prettierrc --ignore-path .gitignore",
"check-format": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore",
"prepublishOnly": "npm run build",
"test": "uvu src \"(spec.mjs|test/index.mjs)\""
"test": "uvu src \"(spec\\.mjs|test/index\\.mjs|test\\\\index\\.mjs)\""
Copy link
Member

@benmccann benmccann Feb 21, 2021

Choose a reason for hiding this comment

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

I wonder if we should make this shorter by doing something like test[/\\\\]index\\.mjs instead of test/index\\.mjs|test\\\\index\\.mjs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, yep, that should work as well. I'll update the PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

@benmccann Interestingly, it fails on Linux instead! I guess I'll revert to the original.

Copy link
Member

Choose a reason for hiding this comment

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

If I use [\\\\/] as the character class it passes on Linux. It looks like you have to switch the order of the slash and backslash or it thinks you're trying to escape the ]

Copy link
Member Author

Choose a reason for hiding this comment

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

If I swap to [\\\\/], it looks like it reverts back to the bugged behavior on Windows. If I do [\\\\\\\\/] it does the same, so it seems to be collapsing down to [\/] which is equivalent to /.

I think uvu is doing something strange with the regex here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, that results in uvu src "(spec\.mjs|test/index[/\\\\].mjs)" but still skips over api/test/index.mjs.

Copy link
Member Author

Choose a reason for hiding this comment

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

pnpm test, yarn test, and npm test all produce the same results, so the behavior is at least consistent across them.

Copy link
Member

Choose a reason for hiding this comment

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

I would say it's better to duplicate that then instead of having to insert some obscure combination of \ and /.

Copy link
Member Author

Choose a reason for hiding this comment

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

Wait, nevermind, PEBCAK, I just noticed that I've been replacing the dot before mjs instead of the path separator. "test": "uvu src \"(spec\\.mjs|test[\\\\/]index\\.mjs)\"" does work.

Copy link
Member Author

Choose a reason for hiding this comment

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

The initial run of the latest change failed at an unrelated test:

> [email protected] test /home/runner/work/kit/kit/test/apps/basics
> node test
   FAIL  dev  "announces client-side navigation [js]"
    Expected values to be deeply equal:  (equal)

        ++Navigated·to·b    (Expected)
        --                  (Actual)
          ^^^^^^^^^^^^^^
    at assert (file:///home/runner/work/kit/kit/node_modules/.pnpm/[email protected]/node_modules/uvu/assert/index.mjs:31:8)

Re-running the Github action successfully passed all tests.

I wonder if a race condition is involved here? There should be no effect on test/apps/basics at all.

@benmccann benmccann merged commit 82945f6 into master Feb 22, 2021
@benmccann benmccann deleted the issue-401 branch February 22, 2021 15:32
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.

kit: uvu test pattern is incorrect (especially on Windows)
3 participants