fix(ci): restore coverage reporting and compatible audit dependencies

This commit is contained in:
haelyra committed 2026-11-16 15:43:15 -05:00
1 parent d4b97e60dd
commit bfaa88690b
5 files changed
+156 -35

No files matched your search

+2
View File
@@ -553,6 +553,8 @@ jobs:
printf 'ecc-pcre2-probe\n' | rg --pcre2 -- '^ecc-pcre2-probe$'
- name: Run coverage
env:
NODE_OPTIONS: --max-old-space-size=4096
run: npm run coverage
- name: Run Python coverage
+23 -15
View File
@@ -274,6 +274,13 @@
"integrity": "sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==",
"license": "ISC"
},
"node_modules/@isaacs/nonrecursive-glob-match": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@isaacs/nonrecursive-glob-match/-/nonrecursive-glob-match-1.1.0.tgz",
"integrity": "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==",
"dev": true,
"license": "BlueOak-1.0.0"
},
"node_modules/@istanbuljs/schema": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz",
@@ -1805,15 +1812,15 @@
}
},
"node_modules/glob": {
"version": "13.0.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz",
"integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==",
"version": "14.0.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-14.0.3.tgz",
"integrity": "sha512-A1vjIwC3qpdCso45Iw127gnp7sPhqgY8lUQhDrArIs+GbmfaaVPFuoyy7WyLT9EPZCRZ7j7aLdwUhQmHWesEow==",
"dev": true,
"license": "BlueOak-1.0.0",
"dependencies": {
"minimatch": "^10.2.2",
"minimatch": "^11.0.2",
"minipass": "^7.1.3",
"path-scurry": "^2.0.2"
"path-scurry": "^3.0.0"
},
"engines": {
"node": "18 || 20 || >=22"
@@ -2314,9 +2321,9 @@
}
},
"node_modules/lru-cache": {
"version": "11.2.7",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.7.tgz",
"integrity": "sha512-aY/R+aEsRelme17KGQa/1ZSIpLpNYYrhcrepKTZgE+W3WM16YMCaPwOHLHsmopZHELU0Ojin1lPVxKR0MihncA==",
"version": "11.5.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz",
"integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==",
"dev": true,
"license": "BlueOak-1.0.0",
"engines": {
@@ -3047,13 +3054,14 @@
}
},
"node_modules/minimatch": {
"version": "10.2.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz",
"integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==",
"version": "11.0.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.2.tgz",
"integrity": "sha512-pWTgz5CN3tjqyZNSK2tePlSmu9IwM41q8yn8Usdqqwe9TIHh+9dEpLLjF4uApsfPEAZY71qtSiA2B2APEr+1Yw==",
"dev": true,
"license": "BlueOak-1.0.0",
"dependencies": {
"brace-expansion": "^5.0.5"
"@isaacs/nonrecursive-glob-match": "^1.0.2",
"brace-expansion": "^5.0.12"
},
"engines": {
"node": "18 || 20 || >=22"
@@ -3284,9 +3292,9 @@
}
},
"node_modules/path-scurry": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz",
"integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==",
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-3.0.0.tgz",
"integrity": "sha512-1pTbQqH1wIwMi/eleQ5leFTTCkzFsPcgXNjwOA8YGGW/W4/kHT3dssE7Z6NH+zuqNLOzOB0uaD61yl7cAcVhgg==",
"dev": true,
"license": "BlueOak-1.0.0",
"dependencies": {
+6 -2
View File
@@ -609,7 +609,9 @@
"brace-expansion": "5.0.12",
"katex": "0.18.2",
"smol-toml": "1.9.1",
"zod": "4.6.7"
"zod": "4.6.7",
"glob": "14.0.3",
"minimatch": "11.0.2"
},
"resolutions": {
"fast-uri": "3.1.9",
@@ -619,7 +621,9 @@
"brace-expansion": "5.0.12",
"katex": "0.18.2",
"smol-toml": "1.9.1",
"zod": "4.6.7"
"zod": "4.6.7",
"glob": "14.0.3",
"minimatch": "11.0.2"
},
"packageManager": "yarn@4.9.2+sha512.1fc009bc09d13cfd0e19efa44cbfc2b9cf6ca61482725eb35bbc5e257e093ebf4130db6dfe15d604ff4b79efd8e1e8e99b25fa7d0a6197c9f9826358d4d65c3c"
}
+99
View File
@@ -0,0 +1,99 @@
'use strict';
const assert = require('node:assert/strict');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
const { spawnSync } = require('node:child_process');
const glob = require('glob');
const rawGlob = require('glob/raw');
function writeFixture(root) {
fs.mkdirSync(path.join(root, 'scripts', 'nested'), { recursive: true });
const files = {
'scripts/alpha.js': 'module.exports = value => value + 1;\n',
'scripts/nested/beta.mjs': 'export const answer = 42;\n',
'scripts/never.js': 'module.exports = value => value - 1;\n',
'scripts/skip.test.js': 'throw new Error("excluded fixture");\n',
'run.mjs': 'import increment from "./scripts/alpha.js";\n'
+ 'import { answer } from "./scripts/nested/beta.mjs";\n'
+ 'if (increment(answer) !== 43) throw new Error("fixture result");\n',
};
for (const [name, content] of Object.entries(files)) {
fs.writeFileSync(path.join(root, name), content);
}
}
function coverageEnvironment() {
// Nested coverage owns its artifacts. Never inherit an outer c8/nyc report
// configuration or V8 instrumentation/preload into the fixture process.
const env = Object.fromEntries(Object.entries(process.env).filter(([name]) => {
const key = name.toUpperCase();
return key !== 'NODE_V8_COVERAGE' && key !== 'NODE_OPTIONS'
&& !key.startsWith('C8_') && !key.startsWith('NYC_');
}));
// Node propagates outer V8 coverage when the key is omitted. An explicit
// empty value keeps the c8 CLI itself out of the outer raw artifact.
return { ...env, NODE_V8_COVERAGE: '', NODE_OPTIONS: '' };
}
function checkDiscovery(root) {
for (const engine of [glob, rawGlob]) {
assert.deepEqual(engine.globSync('scripts/alpha.js', { cwd: root }), ['scripts/alpha.js']);
assert.deepEqual(engine.globSync('scripts/**/*.js', { cwd: root }).sort(), [
'scripts/alpha.js', 'scripts/never.js', 'scripts/skip.test.js',
]);
assert.deepEqual(engine.globSync('scripts/**/*.mjs', { cwd: root }), ['scripts/nested/beta.mjs']);
}
}
function checkCoverage(root) {
const reports = path.join(root, 'reports');
const result = spawnSync(process.execPath, [
require.resolve('c8/bin/c8.js'), '--all',
'--include=scripts/**/*.js', '--include=scripts/**/*.mjs',
'--exclude=scripts/**/*.test.js', '--reporter=json-summary',
'--reports-dir=' + reports, '--temp-directory=' + path.join(root, 'v8'),
process.execPath, 'run.mjs',
], { cwd: root, env: coverageEnvironment(), encoding: 'utf8', timeout: 30000 });
assert.ifError(result.error);
assert.equal(result.status, 0, result.stdout + result.stderr);
const summary = JSON.parse(fs.readFileSync(path.join(reports, 'coverage-summary.json'), 'utf8'));
const files = Object.fromEntries(Object.entries(summary)
.filter(([name]) => name !== 'total')
.map(([name, counts]) => [path.relative(root, name).split(path.sep).join('/'), counts]));
assert.deepEqual(Object.keys(files).sort(), [
'scripts/alpha.js', 'scripts/nested/beta.mjs', 'scripts/never.js',
]);
assert.equal(files['scripts/alpha.js'].lines.covered, 1);
assert.equal(files['scripts/nested/beta.mjs'].lines.covered, 1);
assert.equal(files['scripts/never.js'].lines.covered, 0);
assert.equal(summary.total.lines.total, 3);
assert.equal(summary.total.lines.covered, 2);
}
let passed = 0;
let failed = 0;
function test(name, run) {
try {
run();
passed += 1;
console.log(` ✓ ${name}`);
} catch (error) {
failed += 1;
console.log(` ✗ ${name}\n ${error.message}`);
}
}
const root = (fs.realpathSync.native || fs.realpathSync)(
fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-glob-coverage-'))
);
try {
writeFixture(root);
test('default and raw glob discover literal and wildcard fixture files', () => checkDiscovery(root));
test('c8 --all retains executed and unexecuted source while excluding test files', () => checkCoverage(root));
} finally {
fs.rmSync(root, { recursive: true, force: true });
}
console.log(`\nPassed: ${passed}\nFailed: ${failed}`);
process.exitCode = failed > 0 ? 1 : 0;
+26 -18
View File
@@ -160,6 +160,13 @@ __metadata:
languageName: node
linkType: hard
"@isaacs/nonrecursive-glob-match@npm:^1.0.2":
version: 1.1.0
resolution: "@isaacs/nonrecursive-glob-match@npm:1.1.0"
checksum: 10c0/89f8535f3d8147649360de992f58fba2b0e97b687e18cdc16c5b34a6c52afff4f474d05c5a0b6411708614f368cf19c41b037d3a1c6c6821e02aee967d888e98
languageName: node
linkType: hard
"@istanbuljs/schema@npm:^0.1.2, @istanbuljs/schema@npm:^0.1.3":
version: 0.1.3
resolution: "@istanbuljs/schema@npm:0.1.3"
@@ -1303,14 +1310,14 @@ __metadata:
languageName: node
linkType: hard
"glob@npm:^13.0.6":
version: 13.0.6
resolution: "glob@npm:13.0.6"
"glob@npm:14.0.3":
version: 14.0.3
resolution: "glob@npm:14.0.3"
dependencies:
minimatch: "npm:^10.2.2"
minimatch: "npm:^11.0.2"
minipass: "npm:^7.1.3"
path-scurry: "npm:^2.0.2"
checksum: 10c0/269c236f11a9b50357fe7a8c6aadac667e01deb5242b19c84975628f05f4438d8ee1354bb62c5d6c10f37fd59911b54d7799730633a2786660d8c69f1d18120a
path-scurry: "npm:^3.0.0"
checksum: 10c0/762d4b6e2dc3648e7dbc7f7aa4264fe62cce85014d004c0d0690f9e64471d898ba828c69d2dcd449ac949908fdf02934a9d2c51e444a84171a8f4158a42ef496
languageName: node
linkType: hard
@@ -1645,9 +1652,9 @@ __metadata:
linkType: hard
"lru-cache@npm:^11.0.0":
version: 11.2.7
resolution: "lru-cache@npm:11.2.7"
checksum: 10c0/549cdb59488baa617135fc12159cafb1a97f91079f35093bb3bcad72e849fc64ace636d244212c181dfdf1a99bbfa90757ff303f98561958ee4d0f885d9bd5f7
version: 11.5.3
resolution: "lru-cache@npm:11.5.3"
checksum: 10c0/2ad9bce6343a3544a1fd15364d8b35609aa52b2593d21fdc4877cabfe003b0f3deca4f9d6e9d13262f06e9e3d159de45c0a2f3edfc3adb46192333b5f146d8ed
languageName: node
linkType: hard
@@ -2070,12 +2077,13 @@ __metadata:
languageName: node
linkType: hard
"minimatch@npm:^10.2.2, minimatch@npm:^10.2.4, minimatch@npm:^10.2.5, minimatch@npm:~10.2.5":
version: 10.2.5
resolution: "minimatch@npm:10.2.5"
"minimatch@npm:11.0.2":
version: 11.0.2
resolution: "minimatch@npm:11.0.2"
dependencies:
brace-expansion: "npm:^5.0.5"
checksum: 10c0/6bb058bd6324104b9ec2f763476a35386d05079c1f5fe4fbf1f324a25237cd4534d6813ecd71f48208f4e635c1221899bef94c3c89f7df55698fe373aaae20fd
"@isaacs/nonrecursive-glob-match": "npm:^1.0.2"
brace-expansion: "npm:^5.0.12"
checksum: 10c0/d51bad3e041232d23bf5f3f3858153b273e43c72deecab4528db9c61cff78d16e914cf551a1bcae05d10bf942ebf9d16ce8d9467cc3d289bee939401b405895e
languageName: node
linkType: hard
@@ -2226,13 +2234,13 @@ __metadata:
languageName: node
linkType: hard
"path-scurry@npm:^2.0.2":
version: 2.0.2
resolution: "path-scurry@npm:2.0.2"
"path-scurry@npm:^3.0.0":
version: 3.0.0
resolution: "path-scurry@npm:3.0.0"
dependencies:
lru-cache: "npm:^11.0.0"
minipass: "npm:^7.1.2"
checksum: 10c0/b35ad37cf6557a87fd057121ce2be7695380c9138d93e87ae928609da259ea0a170fac6f3ef1eb3ece8a068e8b7f2f3adf5bb2374cf4d4a57fe484954fcc9482
checksum: 10c0/3256223b51952732bc5460f574143d7d9904cd6d68fac3072906162c90e9f27fdf6f3fe812287e65a876f92d73c12a58368b28749ed07a58bdb04dc76f60a938
languageName: node
linkType: hard