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

Migrate tests to the spec-node runner #1263

Merged
merged 6 commits into from
Aug 6, 2024
Merged

Conversation

fsoikin
Copy link
Collaborator

@fsoikin fsoikin commented Aug 4, 2024

Description of the change

So here it is, as promised, the shiny new spec runner that persists results and takes command-line options.

Full docs here: https://purescript-spec.github.io/purescript-spec/running/#running-under-node

But here are some examples of possible use:

 λ npx spago test -- -E "ModuleParser|bundle"

Running tests for package: docs-search-index
ModuleParser
  ✓︎ test #0
  ✓︎ test #1
  ✓︎ test #2
  ✓︎ test #3
  ✓︎ test #4
  ✓︎ test #5
  ✓︎ test #6
  ✓︎ test #7
  ✓︎ multiline comment #1
  ✓︎ multiline comment #1
  ✓︎ multiline comment #1
  ✓︎ single line comment #1
  ✓︎ single line comment #1
Modules in .spago: 1113
  ✓︎ Parses every module in .spago/

Summary
14/14 tests passed


✓ Test succeeded for package "docs-search-index".

Running tests for package: spago
spago » bundle
  ✓︎ bundles into an app (browser)
  ✓︎ bundles into an app (node)
  ✓︎ bundles into a module
  ✓︎ bundles an app with source map (browser)
  ✓︎ bundles an app with source map (node)
  ✓︎ bundles a module with source map
  ✓︎ bundles a module with extra esbuild arguments
  ✓︎ refuses to overwrite existing bundle that is not Spago-generated
  ✓︎ overwrites non-Spago-generated bundle when there is no magic marker file

Summary
9/9 tests passed


✓ Test succeeded for package "spago".

 λ npx spago test -- -e "into an app (browser)" --timeout 1

Running tests for package: docs-search-index

Summary
0/0 tests passed


✓ Test succeeded for package "docs-search-index".

Running tests for package: spago
spago » bundle
  ✗ bundles into an app (browser):

  test timed out after 1000ms

Summary
0/1 test passed


✘ Tests failed for package "spago".

 λ npx spago test -- --only-failures

Running tests for package: docs-search-index

Summary
0/0 tests passed


✓ Test succeeded for package "docs-search-index".

Running tests for package: spago
spago » bundle
  ✓︎ bundles into an app (browser)

Summary
1/1 test passed


✓ Test succeeded for package "spago".

Checklist:

  • Added the change to the "Unreleased" section of the changelog
  • [ ] Added some example of the new feature to the README
  • [ ] Added a test for the contribution (if applicable)

Copy link
Member

@f-f f-f 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, thank you!

We should add some docs for this:

  • for the contributors (in the CONTRIBUTING.md), I think the --example and --example-matches are the most useful flags to know about
  • and for users, since the question "can I select a subset of tests" comes up often. This section could be expanded to note that you can pass flags to the running tests and select things with --example if using the spec-node runner

@fsoikin
Copy link
Collaborator Author

fsoikin commented Aug 6, 2024

Added docs. Let me know if it's acceptable.

Copy link
Member

@f-f f-f 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 great 👏

@f-f f-f merged commit ac3c117 into purescript:master Aug 6, 2024
5 checks passed
@fsoikin fsoikin deleted the spago-node branch August 8, 2024 17:17
@fsoikin fsoikin mentioned this pull request Aug 10, 2024
2 tasks
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