Skip to content
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

test_runner: adding colors to the xs and dots in the dot test runner #53450

Closed

Conversation

puskin94
Copy link
Contributor

Fixes: #51770

Making sure that, when executing the dot test reporter, dots are white and Xs are red, for better visibility

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Jun 14, 2024
@puskin94 puskin94 changed the title lib: adding colors to the xs and dots in the test runner lib: adding colors to the xs and dots in the dot test runner Jun 14, 2024
const { formatTestReport } = require('internal/test_runner/reporter/utils');
const { red, white, green, clear } = require('internal/util/colors');
Copy link
Member

Choose a reason for hiding this comment

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

please avoid destructuring here so colors.refresh will still work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MoLow thanks for the super prompt response :)

I applied the code change, but I don't see any reference to colors.refresh, can you pinpoint me to the right place?

@puskin94 puskin94 requested a review from MoLow June 14, 2024 09:59
@RedYetiDev
Copy link
Member

IIRC isn't there a PR already open doing this?

Maybe one or the other should be closed in favor?

@puskin94
Copy link
Contributor Author

IIRC isn't there a PR already open doing this?

Maybe one or the other should be closed in favor?

yeah I noticed, but I pushed mine forward anyway because the creator or the other PR didn't push in the last 2 months

@RedYetiDev
Copy link
Member

RedYetiDev commented Jun 14, 2024

No problem! If this gets merged, I'll close the other one.

const { formatTestReport } = require('internal/test_runner/reporter/utils');
const colors = require('internal/util/colors');
Copy link
Member

@atlowChemi atlowChemi Jun 14, 2024

Choose a reason for hiding this comment

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

This seems like an unrelated change, could you revert it? (The import existed already in the line above)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@atlowChemi done!

@puskin94 puskin94 requested a review from atlowChemi June 14, 2024 15:22
@jakecastelli
Copy link
Contributor

jakecastelli commented Jun 14, 2024

Good work on pushing the progress! (Just a thought - I think the origin author might deserve a co-author in the commit message? As the change looks quite identical).

@atlowChemi
Copy link
Member

@puskin94 the PR changes the test_runner submodule, so the first commit message should be prefixed with test_runner and not lib.
Could you please rebase and fix the message? Let me know if you need assistance with that 🙂

@puskin94 puskin94 force-pushed the make-dot-and-x-test-runner-colored branch 4 times, most recently from 8c23d44 to 73885f8 Compare June 15, 2024 08:24
@puskin94 puskin94 force-pushed the make-dot-and-x-test-runner-colored branch from 73885f8 to 68aa96e Compare June 15, 2024 08:26
@puskin94
Copy link
Contributor Author

@puskin94 the PR changes the test_runner submodule, so the first commit message should be prefixed with test_runner and not lib. Could you please rebase and fix the message? Let me know if you need assistance with that 🙂

@atlowChemi it took me a bit to understand the right order of execution of the commands, but we should be there now :) Thanks!

@atlowChemi atlowChemi added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 15, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 15, 2024
@nodejs-github-bot
Copy link
Collaborator

@puskin94 puskin94 changed the title lib: adding colors to the xs and dots in the dot test runner test_runner: adding colors to the xs and dots in the dot test runner Jun 16, 2024
@puskin94
Copy link
Contributor Author

Can anyone help me out here? I see the PR is stuck and I guess it is because of broken jenkins tests...
I tried to reproduce them but everything is passing locally.
What should I do? How can I move?

Thanks in advance!

@MoLow
Copy link
Member

MoLow commented Jun 26, 2024

well this is an example of a failure:

02:35:52         # Subtest: test-runner/output/dot_output_custom_columns.js
02:35:52         not ok 42 - test-runner/output/dot_output_custom_columns.js
02:35:52           ---
02:35:52           duration_ms: 265.745104
02:35:52           location: '/home/iojs/build/workspace/node-test-commit-arm/test/parallel/test-runner-output.mjs:156:5'
02:35:52           failureType: 'testCodeFailure'
02:35:52           error: |-
02:35:52             Expected values to be strictly equal:
02:35:52             + actual - expected
02:35:52             
02:35:52             + '..............................\n' +
02:35:52             +   '.........................................\n' +
02:35:52             +   '.............................\n'
02:35:52             - '[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c\n' +
02:35:52             -   '[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c\n' +
02:35:52             -   '[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c\n'
02:35:52           code: 'ERR_ASSERTION'
02:35:52           name: 'AssertionError'
02:35:52           expected: |-
02:35:52             [32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c
02:35:52             [32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c
02:35:52             [32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c
02:35:52             
02:35:52           actual: |-
02:35:52             ..............................
02:35:52             .........................................
02:35:52             .............................
02:35:52             
02:35:52           operator: 'strictEqual'
02:35:52           stack: |-
02:35:52             assertSnapshot (/home/iojs/build/workspace/node-test-commit-arm/test/common/assertSnapshot.js:56:12)
02:35:52             async Module.spawnAndAssert (/home/iojs/build/workspace/node-test-commit-arm/test/common/assertSnapshot.js:84:3)
02:35:52             async TestContext.<anonymous> (file:///home/iojs/build/workspace/node-test-commit-arm/test/parallel/test-runner-output.mjs:150:5)
02:35:52             async Test.run (node:internal/test_runner/test:857:9)
02:35:52             async Promise.all (index 41)
02:35:52             async Suite.run (node:internal/test_runner/test:1217:7)
02:35:52             async Test.processPendingSubtests (node:internal/test_runner/test:565:7)
02:35:52           ...

it seems the CI doesn't always run in a TTY so output is not colored.

you should probably add this snippet to emulate coloring in all envs:

'use strict';
process.env.FORCE_COLOR = '1';
delete process.env.NODE_DISABLE_COLORS;
delete process.env.NO_COLOR;

@MoLow MoLow added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 2, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 3, 2024
@nodejs-github-bot
Copy link
Collaborator

@MoLow MoLow added commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jul 4, 2024
@puskin94
Copy link
Contributor Author

Is this MR waiting for something else before "Landing" ? I am reading the docs and it looks like I have all the required steps? Or am I missing something?

MoLow pushed a commit to MoLow/node that referenced this pull request Jul 23, 2024
PR-URL: nodejs#53450
Fixes: nodejs#51770
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@MoLow
Copy link
Member

MoLow commented Jul 23, 2024

Landed in 8536b67

@MoLow MoLow closed this Jul 23, 2024
targos pushed a commit that referenced this pull request Jul 28, 2024
PR-URL: #53450
Fixes: #51770
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@RafaelGSS RafaelGSS mentioned this pull request Jul 30, 2024
RafaelGSS pushed a commit that referenced this pull request Aug 5, 2024
PR-URL: #53450
Fixes: #51770
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
targos pushed a commit that referenced this pull request Sep 21, 2024
PR-URL: #53450
Fixes: #51770
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
targos pushed a commit that referenced this pull request Oct 2, 2024
PR-URL: #53450
Fixes: #51770
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test_runner: make the dot reporter colored
7 participants