Skip to content

Conversation

@Uzlopak
Copy link
Collaborator

@Uzlopak Uzlopak commented Sep 23, 2025

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.

@Uzlopak Uzlopak requested review from Copilot and mcollina September 23, 2025 12:00
Copy link

Copilot AI left a 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 done callback option for handling test completion with optional error handling
  • Exposes assertion methods through t.assert property 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.

@Uzlopak Uzlopak requested a review from Copilot September 23, 2025 13:06
Copy link

Copilot AI left a 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.

Copy link
Owner

@mcollina mcollina left a 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?

@Uzlopak
Copy link
Collaborator Author

Uzlopak commented Sep 23, 2025

@mcollina

t.plan is now working like the one from node test runner.

@Uzlopak Uzlopak requested a review from Copilot September 23, 2025 18:52
Copy link

Copilot AI left a 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.

@Uzlopak Uzlopak requested a review from mcollina September 23, 2025 19:04
@Uzlopak
Copy link
Collaborator Author

Uzlopak commented Sep 23, 2025

modified the readme

@mcollina
PTAL

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.

3 participants