From 8120112318b312b442a8fc2a077018626a9d7b2d Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Fri, 19 Apr 2024 12:40:47 -0400 Subject: [PATCH] test: remove dependency on "true" which is not on all windows sytems test: add --fix command for easier local development build: turn off npm updates which were causing issues with snapshots Co-authored-by: Austin Akers Co-authored-by: Austin Akers --- .github/workflows/ci.yaml | 4 +- .github/workflows/release-please.yml | 1 - package-lock.json | 49 +++++++++++++++---- package.json | 3 +- .../test/nyc-integration.js.test.cjs | 1 + test/helpers/run-nyc.js | 4 +- test/helpers/test-success.js | 1 - test/nyc-integration.js | 3 +- 8 files changed, 49 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5af1be9b9..dd2830fed 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,7 +19,7 @@ jobs: with: node-version: ${{ matrix.node }} cache: npm - - run: npm i npm@latest -g + - run: npm config set update-notifier false - run: npm ci --engine-strict - run: npm test windows: @@ -30,6 +30,6 @@ jobs: with: node-version: lts/* cache: npm - - run: npm i npm@latest -g + - run: npm config set update-notifier false - run: npm ci - run: npm test diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index a8702b749..4882de220 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -21,7 +21,6 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 16 - registry-url: 'https://external-dot-oss-automation.appspot.com' cache: npm if: ${{ steps.release.outputs.release_created }} - run: npm publish diff --git a/package-lock.json b/package-lock.json index 539092140..64aaef634 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "glob": "^7.1.6", "istanbul-lib-coverage": "^3.0.0", "istanbul-lib-hook": "^3.0.0", - "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-instrument": "^6.0.2", "istanbul-lib-processinfo": "^2.0.2", "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^4.0.0", @@ -6622,19 +6622,50 @@ } }, "node_modules/istanbul-lib-instrument": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", - "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.2.tgz", + "integrity": "sha512-1WUsZ9R1lA0HtBSohTkm39WTPlNKSJ5iFk7UwqXkBLoHQT+hfqPsfsTDVuZdKGaBwn7din9bS7SsnoAr943hvw==", "dependencies": { - "@babel/core": "^7.7.5", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.0.0", - "semver": "^6.3.0" + "@babel/core": "^7.23.9", + "@babel/parser": "^7.23.9", + "@istanbuljs/schema": "^0.1.3", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" }, "engines": { - "node": ">=8" + "node": ">=10" + } + }, + "node_modules/istanbul-lib-instrument/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" } }, + "node_modules/istanbul-lib-instrument/node_modules/semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-instrument/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "node_modules/istanbul-lib-processinfo": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.3.tgz", diff --git a/package.json b/package.json index f55152ec4..acededa27 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "pretest": "npm run lint && npm run clean && npm run instrument", "test": "tap", "snap": "npm test -- --snapshot", + "fix": "standard --fix", "posttest": "npm run report", "clean": "node ./npm-run-clean.js", "instrument": "node ./build-self-coverage.js", @@ -68,7 +69,7 @@ "glob": "^7.1.6", "istanbul-lib-coverage": "^3.0.0", "istanbul-lib-hook": "^3.0.0", - "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-instrument": "^6.0.2", "istanbul-lib-processinfo": "^2.0.2", "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^4.0.0", diff --git a/tap-snapshots/test/nyc-integration.js.test.cjs b/tap-snapshots/test/nyc-integration.js.test.cjs index 5a707ec3a..da4d90431 100644 --- a/tap-snapshots/test/nyc-integration.js.test.cjs +++ b/tap-snapshots/test/nyc-integration.js.test.cjs @@ -888,6 +888,7 @@ exports[`test/nyc-integration.js > TAP > passes configuration via environment va ` exports[`test/nyc-integration.js > TAP > recursive run does not throw > stdout 1`] = ` +hello ` diff --git a/test/helpers/run-nyc.js b/test/helpers/run-nyc.js index ca0adcecf..04bd5bf10 100644 --- a/test/helpers/run-nyc.js +++ b/test/helpers/run-nyc.js @@ -47,8 +47,8 @@ async function runNYC ({ args, tempDir, leavePathSep, cwd = fixturesCLI, env = { stderr, stdout }, - stderr: sanitizeString(stderr, cwd, leavePathSep), - stdout: sanitizeString(stdout, cwd, leavePathSep) + stderr: sanitizeString(stderr.toString('utf8'), cwd, leavePathSep), + stdout: sanitizeString(stdout.toString('utf8'), cwd, leavePathSep) } } diff --git a/test/helpers/test-success.js b/test/helpers/test-success.js index 1a982789c..0841cbc3d 100644 --- a/test/helpers/test-success.js +++ b/test/helpers/test-success.js @@ -10,7 +10,6 @@ async function testSuccess (t, opts) { t.equal(status, 0) t.equal(stderr, '') - console.info(stdout) t.matchSnapshot(stdout, 'stdout') } diff --git a/test/nyc-integration.js b/test/nyc-integration.js index 0ab1ece28..e510b2d95 100644 --- a/test/nyc-integration.js +++ b/test/nyc-integration.js @@ -591,7 +591,8 @@ t.test('recursive run does not throw', t => testSuccess(t, { nycBin, process.execPath, nycBin, - 'true' + 'echo', + 'hello' ], cwd: path.resolve(__dirname, 'fixtures/recursive-run') }))