-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Specify that spec
reporter is a class and needs to be instantiate for usage with run
#48112
Comments
are you interested in opening a PR for this? |
Not sure how to get started with PR @MoLow But I think we also need to discuss if api (and behavior) of all |
why? |
But it is just a matter of preference. I have reported oddity with the API docs, it is up to the maintainers how they wish to fix this :) |
All lowercase name usually means a function, classes would typically use PascalCase. I agree this is odd, we should fix it either by renaming it and deprecating the old name, or replace it with a function. The latter has the advantage of being doable without any breaking change (hopefully). |
Hey @MoLow, I see you added good first issue tag to this issue. Can I take this? |
Yeah 👍 |
I am thinking of replacing |
Other reporters (dot, tap) by signature are a function while 'spec' reporter is a ES6 class. This behaviour of api spec is causing difference in semantics while consumption since it has not been addressed anywhere in the document (it has to be instantiated). Instead of making changes in the signature of spec.js, i have proposed changes where the 'spec' reporter gets exposed in reporter.js Fixes: nodejs#48112 Refs: https://github.com/nodejs/node/blob/main/lib/internal/test_runner/reporter/spec.js Refs: (@line-no:143) https://github.com/nodejs/node/blob/main/lib/internal/test_runner/utils.js
Hi @MoLow, I was curious to take up this issue. They were in two files, according to where we want to make change (signature/ exposure) :
So instead of making amends to the original signature of 'spec' reporter, I have made change where it is getting exposed in reporters.js. Kindly check whether this approach is feasible and correct ? |
Hi @Sumi0, I didn't see your PR that was opened. Please let me know if I need to close my PR, which changes the spec class to a function. |
I personally prefer #48202 |
I had 2 questions @MoLow, @aduh95 :
|
There would be a GitHub notification if they are subscribed to that PR (and they would typically be because the bot pings the team "owning" the modified files).
You count the chars I guess, and when the line grows larger than 72 chars, you add a line return at the start of the word. If that guideline is not met, the CQ will refuse to land the PR. |
So how should one change the commit message afterwards ? |
|
Or you can use |
is this issue still open? |
Fixes: #48112 Ref: #48208 PR-URL: #49184 Refs: #48208 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
Fixes: #48112 Ref: #48208 PR-URL: #49184 Refs: #48208 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
Fixes: #48112 Ref: #48208 PR-URL: #49184 Refs: #48208 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
Fixes: nodejs/node#48112 Ref: nodejs/node#48208 PR-URL: nodejs/node#49184 Refs: nodejs/node#48208 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
Fixes: nodejs/node#48112 Ref: nodejs/node#48208 PR-URL: nodejs/node#49184 Refs: nodejs/node#48208 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
Affected URL(s)
https://nodejs.org/api/test.html#test-reporters
Description of the problem
When importing
spec
test reporter, you need to instantiate it otherwise you will get no output, for exampleimport { run } from "node:test"; import { tap, spec } from "node:test/reporters"; import { resolve } from "path"; const files = [resolve("./test/test.js")]; run({ files, concurrency: 1, timeout: 10000, }) --- .compose(spec) +++.compose(new spec()) .pipe(process.stdout);
Documentation should indicate that
spec
reporter is exported as a class unliketap
anddot
reporters.The text was updated successfully, but these errors were encountered: