Skip to content

test_runner: handled change for exposing 'spec' reporter - #48202

Closed
Sumi0 wants to merge 3 commits into
nodejs:mainfrom
Sumi0:main
Closed

test_runner: handled change for exposing 'spec' reporter#48202
Sumi0 wants to merge 3 commits into
nodejs:mainfrom
Sumi0:main

Conversation

@Sumi0

@Sumi0Sumi0 commented May 27, 2023

Copy link
Copy Markdown

Fixes: Issue#48112

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

Refs: reporter/spec.js
Refs: (@line-no:143) test_runner/utils.js

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
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-botnodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels May 27, 2023
Comment threadlib/test/reporters.js Outdated
Comment threadlib/test/reporters.js Outdated
@MoLow
MoLow requested a review from aduh95June 1, 2023 06:47
@Sumi0

Sumi0 commented Jun 1, 2023

Copy link
Copy Markdown
Author

I do not understand why is the test failing @line-no:79 test-runner-run.mjs.
Where could be the root-cause ? @MoLow@aduh95

@MoLow

MoLow commented Jun 1, 2023

Copy link
Copy Markdown
Member

you should debug locally with ./node test/parallel/test-runner-run.mjs

@Sumi0

Sumi0 commented Jun 1, 2023

Copy link
Copy Markdown
Author

I do not understand why is the test failing @line-no:79 test-runner-run.mjs.
Where could be the root-cause ? @MoLow@aduh95

 not ok 9 - should be piped with spec
---
duration_ms: 1767.493155
failureType: 'cancelledByParent'
error: 'Promise resolution is still pending but the event loop has already resolved'
code: 'ERR_TEST_FAILURE'
stack: |-
process.emit (node:events:523:35)
...

Comment threadlib/test/reporters.js
Comment on lines +24 to +25
value: spec ?? function SpecReporter() {
return ReflectConstruct(require('internal/test_runner/reporter/spec'), arguments);

@aduh95aduh95Jun 1, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
value: spec??functionSpecReporter(){
returnReflectConstruct(require('internal/test_runner/reporter/spec'),arguments);
value: functionSpecReporter(){
spec??=require('internal/test_runner/reporter/spec');
returnReflectConstruct(spec,arguments,new.target);

(not sure about the new.target)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me run full test this time on my local and check.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atlowChemi I have tried all versions of returning instance of a class (imported with require), either with new keyword or with Reflect.construct, and both are not working.
I am not able to identify the Root cause.

@cjihrig

Copy link
Copy Markdown
Contributor

@Sumi0 are you still planning to work on this, or should it be closed?

@aduh95aduh95 added the stalled Issues and PRs that are stalled. label May 11, 2024
@github-actions

Copy link
Copy Markdown
Contributor

This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open.

@benjamingr

Copy link
Copy Markdown
Member

This was already superseded by #49184

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ciPRs that need a full CI run.stalledIssues and PRs that are stalled.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Specify that spec reporter is a class and needs to be instantiate for usage with run

6 participants

@Sumi0@nodejs-github-bot@MoLow@cjihrig@benjamingr@aduh95