Skip to content

Conversation

@philnash
Copy link
Contributor

@philnash philnash commented Oct 2, 2023

Fixes #49626

@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 Issues and PRs related to the tests. test_runner Issues and PRs related to the test runner subsystem. labels Oct 2, 2023
@atlowChemi
Copy link
Member

@philnash could you please rebase on top of main? AFAIK merge commits break the CI

@philnash
Copy link
Contributor Author

philnash commented Oct 3, 2023

@atlowChemi Ah, sure. The GitHub interface just gave me that option. Will rebase and respond to your other comments too.

@philnash philnash force-pushed the test-runner-lcov-reporter branch from 7fb19d3 to 44a2ee2 Compare October 3, 2023 09:32
Copy link
Member

@MoLow MoLow left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution 🎉

@MoLow MoLow added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Oct 3, 2023
@philnash
Copy link
Contributor Author

philnash commented Oct 3, 2023

I don't know what's wrong with that one failed job. Anyone understand and can give me a pointer for how to fix?

// https://ltp.sourceforge.net/coverage/lcov/geninfo.1.php
// Excerpts from this documentation are included in the comments that make up
// the _transform function below.
class LcovReporter extends Transform {
Copy link
Member

Choose a reason for hiding this comment

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

This can be written more cleanly with modern stream machinery but I'm 100% OK with landing and then refactoring.

@benjamingr
Copy link
Member

I've rerun the failed GH CI job it fail on an unrelated cluster test test-cluster-primary-kill.js I'll also trigger Jenkins CI

@benjamingr benjamingr added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 3, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 3, 2023
@nodejs-github-bot
Copy link
Collaborator

@benjamingr
Copy link
Member

The test runner failures test-runner-output seem related:

18:57:19         # Subtest: test-runner/output/lcov_reporter.js
18:57:19         not ok 20 - test-runner/output/lcov_reporter.js
18:57:19           ---
18:57:19           duration_ms: 736.44068
18:57:19           location: 'file:///home/iojs/build/workspace/node-test-commit-linux-containered/test/parallel/test-runner-output.mjs:136:5'
18:57:19           failureType: 'testCodeFailure'
18:57:19           error: |-
18:57:19             Expected values to be strictly equal:
18:57:19             + actual - expected ... Lines skipped
18:57:19             
18:57:19             + '\n\n'
18:57:19             ...
18:57:19             - 'TN:\n' +
18:57:19             -   'SF:test/fixtures/test-runner/output/output.js\n' +
18:57:19             -   'FN:8,anonymous_0\n' +
18:57:19             -   'FN:12,anonymous_1\n' +
18:57:19             -   'FN:16,anonymous_2\n' +
18:57:19             -   'FN:21,anonymous_3\n' +
18:57:19             -   'FN:26,anonymous_4\n' +
18:57:19             -   'FN:30,anonymous_5\n' +
18:57:19             -   'FN:34,anonymous_6\n' +
18:57:19             -   'FN:38,anonymous_7\n' +
18:57:19             -   'FN:42,anonymous_8\n' +
18:57:19             -   'FN:46,anonymous_9\n' +
18:57:19             -   'FN:50,anonymous_10\n' +
18:57:19             -   'FN:54,anonymous_11\n' +
18:57:19             -   'FN:59,anonymous_12\n' +
18:57:19             -   'FN:64,anonymous_13\n' +
18:57:19             -   'FN:68,anonymous_14\n' +
18:57:19             -   'FN:72,anonymous_15\n' +
18:57:19             -   'FN:76,anonymous_16\n' +
18:57:19             -   'FN:80,anonymous_17\n' +
18:57:19             -   'FN:81,anonymous_18\n' +
18:57:19             -   'FN:86,anonymous_19\n' +
18:57:19             -   'FN:87,anonymous_20\n' +
18:57:19             -   'FN:92,anonymous_21\n' +
18:57:19             -   'FN:93,anonymous_22\n' +
18:57:19             -   'FN:94,anonymous_23\n' +
18:57:19             -   'FN:100,anonymous_24\n' +
18:57:19             -   'FN:101,anonymous_25\n' +
18:57:19             -   'FN:107,anonymous_26\n' +
18:57:19             -   'FN:111,anonymous_27\n' +
18:57:19             -   'FN:112,anonymous_28\n' +
18:57:19             -   'FN:113,anonymous_29\n' +
18:57:19             -   'FN:114,anonymous_30\n' +
18:57:19             -   'FN:122,anonymous_31\n' +
18:57:19             -   'FN:123,anonymous_32\n' +
18:57:19             -   'FN:130,anonymous_33\n' +
18:57:19             -   'FN:131,anonymous_34\n' +
18:57:19             -   'FN:132,anonymous_35\n' +
18:57:19             -   'FN:140,anonymous_36\n' +
18:57:19             -   'FN:141,anonymous_37\n' +
18:57:19             -   'FN:142,anonymous_38\n' +
18:57:19             -   'FN:150,anonymous_39\n' +
18:57:19             -   'FN:151,anonymous_40\n' +
18:57:19             -   'FN:159,anonymous_41\n' +
18:57:19             -   'FN:160,anonymous_42\n' +
18:57:19             -   'FN:161,anonymous_43\n' +
18:57:19             -   'FN:166,anonymous_44\n' +
18:57:19             -   'FN:167,anonymous_45\n' +
18:57:19             -   'FN:171,anonymous_46\n' +
18:57:19             -   'FN:172,anonymous_47\n' +
18:57:19             ...
18:57:19           code: 'ERR_ASSERTION'
18:57:19           name: 'AssertionError'

@benjamingr
Copy link
Member

Note this is flaky - it failed on one machine but not others

// Then there is a list of execution counts for each instrumented line
// (i.e. a line which resulted in executable code):
// ## DA:\<line number\>,\<execution count\>[,\<checksum\>]
const sortedLines = [...file.lines].sort((a, b) => a.line - b.line);
Copy link
Member

Choose a reason for hiding this comment

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

Two nits - prefer the primordial (ArrayPrototypeSort) and you can do [...file.lines].sort(/**/) as file.lines.toSorted(/**/)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I originally had this as toSorted but I got in my head about using newer JS features for some reason. Though on that note, should something like toSorted be a primordial too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed this to toSorted. I couldn't find how to define a new primordial. I'd be happy to add one if someone can point me in the right direction.

Copy link
Member

@atlowChemi atlowChemi Oct 4, 2023

Choose a reason for hiding this comment

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

@philnash primordials should exist for any function that exists on the prototype...

// Create copies of intrinsic objects
[
'AggregateError',
'Array',
'ArrayBuffer',
'BigInt',
'BigInt64Array',
'BigUint64Array',
'Boolean',
'DataView',
'Date',
'Error',
'EvalError',
'FinalizationRegistry',
'Float32Array',
'Float64Array',
'Function',
'Int16Array',
'Int32Array',
'Int8Array',
'Map',
'Number',
'Object',
'RangeError',
'ReferenceError',
'RegExp',
'Set',
'String',
'Symbol',
'SyntaxError',
'TypeError',
'URIError',
'Uint16Array',
'Uint32Array',
'Uint8Array',
'Uint8ClampedArray',
'WeakMap',
'WeakRef',
'WeakSet',
].forEach((name) => {
// eslint-disable-next-line no-restricted-globals
const original = globalThis[name];
primordials[name] = original;
copyPropsRenamed(original, primordials, name);
copyPrototype(original.prototype, primordials, `${name}Prototype`);
});

image

@atlowChemi
Copy link
Member

Note this is flaky - it failed on one machine but not others

I think this test might need to be disabled on machines without inspector. see

const skipIfNoInspector = {
skip: !process.features.inspector ? 'inspector disabled' : false
};

for (const { name, fn } of tests) {
it(name, fn);
for (const { name, fn, options } of tests) {
it(name, fn, options);
Copy link
Member

@atlowChemi atlowChemi Oct 4, 2023

Choose a reason for hiding this comment

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

I think the order should be:

Suggested change
it(name, fn, options);
it(name, options, fn);

## `it([name][, options][, fn])`

} else if (typeof options === 'function') {
fn = options;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, you are correct. 🤦‍♂️ So the actual options here were just getting ignored and the tests still passed.

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

@philnash
Copy link
Contributor Author

philnash commented Oct 4, 2023

Ah, those are fails because there was no inspector. The test was skipped, but the test also included a spy saying it must be called, so it failed for that reason. Readjusting the test skipping now.

@nodejs-github-bot nodejs-github-bot merged commit c60c11a into nodejs:main Oct 25, 2023
@nodejs-github-bot
Copy link
Collaborator

Landed in c60c11a

@targos
Copy link
Member

targos commented Nov 13, 2023

This is semver-minor. Collaborators, please think about adding the label in future pull requests. It will make the work of releasers easier.

@UlisesGascon UlisesGascon mentioned this pull request Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run. notable-change PRs with changes that should be highlighted in changelogs. semver-minor PRs that contain new features and should be released in the next minor version. test_runner Issues and PRs related to the test runner subsystem. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_runner: lcov reporter for test coverage

9 participants