-
-
Couldn't load subscription status.
- Fork 6
refactor: improve compatibility with node test runner #14
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors tspl to improve compatibility with the Node.js test runner by adding new features and generating types from JSDoc comments. The changes include adding a t.plan() method, providing a done callback option, and exposing assertion methods through both direct properties and a dedicated t.assert object.
- Adds
t.plan()method to dynamically set the expected number of assertions - Introduces
donecallback option for handling test completion with optional error handling - Exposes assertion methods through
t.assertproperty for better compatibility with Node.js test patterns
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tspl.js | Core refactoring with JSDoc types, plan method, done callback, and assert property |
| tspl.test-d.ts | Type definition tests for the new assert property |
| tsconfig.types.json | TypeScript configuration for generating types from JSDoc |
| test.js | Comprehensive test coverage for new features including done callback and assert property |
| package.json | Build scripts for type generation and TypeScript dependency |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update the readme?
|
t.plan is now working like the one from node test runner. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
modified the readme @mcollina |
This is making tspl closer to node test runner.
Also types are generated from jsdoc.
Adds t.plan method to set the plan.
This will help in the long run, to remove tspl in the future, when people drop node 18 and node 20 support.
Tested directly against undici repo and it worked accordingly.