GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: refactor test-abortcontroller to use node:test by jasnell · Pull Request #54574 · nodejs/node

Conversation

@jasnell

@jasnell jasnell commented Aug 26, 2024

Copy link
Copy Markdown
Member

Starting the long process of refactoring our own tests to use the node:test module and mocks.

Also, splits the test that depends on internal API from the rest of the tests to make it easier to differentiate.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jasnell
test: refactor test-abortcontroller to use node:test
fb44af9
Starting the long process of refactoring our own tests to use
the node:test module and mocks.
@jasnell
jasnell requested a review from anonrig August 26, 2024 20:49
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to Node.js core tests and test infrastructure. labels Aug 26, 2024
@jasnell
jasnell requested a review from mcollina August 26, 2024 20:49
anonrig
anonrig approved these changes Aug 26, 2024
View reviewed changes
Comment thread test/parallel/test-abortcontroller.js
@@ -1,7 +1,7 @@
// Flags: --no-warnings --expose-gc --expose-internals
// Flags: --expose-gc

@anonrig anonrig Aug 26, 2024

Copy link
Copy Markdown
Member

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.

I think we should add an eslint rule to avoid re-adding expose-internals to files that we avoid.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jasnell jasnell added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Aug 26, 2024
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Aug 26, 2024
@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
@codecov

This comment was marked as outdated.

Sign in to view
@cjihrig

cjihrig commented Aug 27, 2024

Copy link
Copy Markdown
Contributor

Starting the long process of refactoring our own tests to use the node:test module

Not that I mind, but I'm curious what the motivation is for this? I'm assuming something related to Workers.

lpinca reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Aug 27, 2024

Copy link
Copy Markdown
Member Author

Not that I mind, but I'm curious what the motivation is for this? I'm assuming something related to Workers.

Key motivation is make the tests more structured and easier to decompose... and yes, it's largely for other runtimes that want to be able to run/port the tests more easily in order to better verify Node.js compatibility. But it's also just good to have improved structure in our own tests just for us.

cjihrig reacted with rocket emoji
All reactions
  • 🚀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lpinca

lpinca commented Aug 27, 2024

Copy link
Copy Markdown
Member

Key motivation is make the tests more structured and easier to decompose... and yes, it's largely for other runtimes that want to be able to run/port the tests more easily in order to better verify Node.js compatibility

To be honest, I think it goes in the opposite direction. Using BDD specific syntax does not help.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Aug 27, 2024

Copy link
Copy Markdown
Member Author

... Using BDD specific syntax does not help.

As someone who has been working to port many of these tests to another runtime adding this kind of structure does help significantly. The current unstructured tests mix a number of public API, internal API, and test harness code in ways that make it difficult and time consuming to decompose or, often, to even know what exactly is being tested. Sure, the organization can be further improved but introducing some structure and organization is objectively better than having none, which is what we have now.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
@cjihrig

cjihrig commented Aug 27, 2024

Copy link
Copy Markdown
Contributor

The current unstructured tests mix a number of public API, internal API, and test harness code in ways that make it difficult and time consuming to decompose or, often, to even know what exactly is being tested.

As someone who has also ported many Node tests to another runtime, I can confirm that was a pain point for me at the time.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lpinca

lpinca commented Aug 27, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

The current unstructured tests mix a number of public API, internal API, and test harness code in ways that make it difficult and time consuming to decompose or, often, to even know what exactly is being tested

Using node:test does not change that, it only add an additional module to the mix and a specific non portable test syntax. I think there is nothing better than a single file per test with no dependencies other than the strictly necessary ones. I said it elsewhere but I'll say it again. I have always loved the way tests were made and run in Node.js: a single script with no bullshit just like the minimal test cases we maintainers ask for bug reports.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Aug 27, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

... Using node:test does not change that,

Not sure we'll agree on this point. Decomposing the tests into more structured units; going through the tests and relying, as much as possible, on public API surface (for instance, replacing common.mustCall(...) with mock.fn() checks); and having cleaner separation between things that are testing public API vs internal API helps significantly in porting these tests to other environments to ensure compatibility. Sure, the syntax isn't perfect but this absolutely helps the process along.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lpinca

lpinca commented Aug 27, 2024

Copy link
Copy Markdown
Member

replacing common.mustCall(...) with mock.fn() checks

Yes, I disagree. The common module is still required, so we actually end up duplicating/adding more code.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cjihrig
cjihrig approved these changes Aug 28, 2024
View reviewed changes
@jasnell jasnell added request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. and removed request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Aug 28, 2024
@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
@nodejs-github-bot

nodejs-github-bot commented Aug 28, 2024 •
edited by jasnell
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/61617/ 💚

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell added a commit that referenced this pull request Aug 29, 2024
@jasnell
test: refactor test-abortcontroller to use node:test
39215e1
Starting the long process of refactoring our own tests to use
the node:test module and mocks.

PR-URL: #54574
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
@jasnell

jasnell commented Aug 29, 2024

Copy link
Copy Markdown
Member Author

Landed in 39215e1

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell jasnell closed this Aug 29, 2024
RafaelGSS pushed a commit that referenced this pull request Aug 30, 2024
@jasnell @RafaelGSS
test: refactor test-abortcontroller to use node:test
64442fc
Starting the long process of refactoring our own tests to use
the node:test module and mocks.

PR-URL: #54574
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
@RafaelGSS RafaelGSS mentioned this pull request Aug 30, 2024
v22.8.0 proposal #54560
Merged
@targos targos added the dont-land-on-v20.x label Sep 22, 2024
@lpinca lpinca mentioned this pull request Jan 22, 2025
improve the structure of the test-event-emitter-num-args file and use the node test runner #56671
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@anonrig anonrig anonrig approved these changes
@cjihrig cjihrig cjihrig approved these changes
@mcollina mcollina Awaiting requested review from mcollina

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

needs-ci PRs that need a full CI run. test Issues and PRs related to Node.js core tests and test infrastructure.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@jasnell @nodejs-github-bot @cjihrig @lpinca @anonrig @targos
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.