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

feat: New test package #158

Merged
merged 18 commits into from
Sep 10, 2024
Merged

feat: New test package #158

merged 18 commits into from
Sep 10, 2024

Conversation

Fryuni
Copy link
Owner

@Fryuni Fryuni commented Sep 5, 2024

This new package is essentially the test-utils, the test adapter, and the node module validation plugin from the Astro core repo, but with the following modifications:

  • Remove any reference to internals so it works outside the mono repo without relying on the package installation paths
  • Make everything properly typed so TS is happy (and fix some bugs that were not being caught because it was not typed)
  • Remove some pieces that are only relevant to test internal Astro behavior (by causing specific internal states)
  • Make the plugin check for any node module instead of a shortlist
  • Wrap some too permissive and dangerous APIs (because they are meant to be internal) in more user-friendly wrappers
  • Add documentation to all the exposed APIs for testing
  • Make it test-framework agnostic. Works Vitest, Node tests, Playwright, ...
  • Make paths relative to the test using the utility and not to the utility itself (since it is now a dependency and not part of the project)

Copy link

vercel bot commented Sep 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
inox-tools ✅ Ready (Inspect) Visit Preview Sep 10, 2024 2:19am

Copy link
Collaborator

@florian-lefebvre florian-lefebvre left a comment

Choose a reason for hiding this comment

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

Haven't reviewed the PR but I think there's work done by Alex to have astro/test-utils. I'm afraid this package would be made useless by his work. Let's double check first!

@Fryuni
Copy link
Owner Author

Fryuni commented Sep 6, 2024

There is ongoing conversation about having this in the Astro core repo to be published under @astrojs/.

I'll still need this to test existing and future Inox Tools packages until that lands on Astro. If/when that happens, this package can be deprecated.

Copy link
Collaborator

@dreyfus92 dreyfus92 left a comment

Choose a reason for hiding this comment

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

This is amazing, I left a couple of suggestions to improve clarity. Let me know what you think 😁

docs/src/content/docs/astro-tests.mdx Outdated Show resolved Hide resolved
docs/src/content/docs/astro-tests.mdx Outdated Show resolved Hide resolved
docs/src/content/docs/astro-tests.mdx Outdated Show resolved Hide resolved
docs/src/content/docs/astro-tests.mdx Outdated Show resolved Hide resolved
docs/src/content/docs/astro-tests.mdx Outdated Show resolved Hide resolved
docs/src/content/docs/astro-tests.mdx Outdated Show resolved Hide resolved
docs/src/content/docs/astro-tests.mdx Outdated Show resolved Hide resolved
docs/src/content/docs/astro-tests.mdx Outdated Show resolved Hide resolved
docs/src/content/docs/astro-tests.mdx Outdated Show resolved Hide resolved
docs/src/content/docs/astro-tests.mdx Outdated Show resolved Hide resolved
Co-authored-by: Paul Valladares <85648028+dreyfus92@users.noreply.github.com>
Signed-off-by: Luiz Ferraz <luiz@lferraz.com>
@Fryuni
Copy link
Owner Author

Fryuni commented Sep 10, 2024

I will merge this to proceed with testing everything on Inox Tools. We can always come back to it as others develop opinions about it.

@Fryuni Fryuni merged commit 2180f7b into main Sep 10, 2024
19 checks passed
@Fryuni Fryuni deleted the feat/tests branch September 10, 2024 02:20
Fryuni added a commit that referenced this pull request Sep 10, 2024
Co-authored-by: Florian Lefebvre <69633530+florian-lefebvre@users.noreply.github.com>
Co-authored-by: Paul Valladares <85648028+dreyfus92@users.noreply.github.com>
Signed-off-by: Luiz Ferraz <luiz@lferraz.com>
Fryuni added a commit that referenced this pull request Sep 10, 2024
Co-authored-by: Florian Lefebvre <69633530+florian-lefebvre@users.noreply.github.com>
Co-authored-by: Paul Valladares <85648028+dreyfus92@users.noreply.github.com>
Signed-off-by: Luiz Ferraz <luiz@lferraz.com>
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.

3 participants