Skip to content

Commit 522f290

Browse files
committed
updated test-success, convert buffer to string, added fix script
1 parent 48877df commit 522f290

File tree

7 files changed

+49
-18
lines changed

7 files changed

+49
-18
lines changed

.github/workflows/release-please.yml

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
- uses: actions/setup-node@v3
2222
with:
2323
node-version: 16
24-
registry-url: 'https://external-dot-oss-automation.appspot.com'
2524
cache: npm
2625
if: ${{ steps.release.outputs.release_created }}
2726
- run: npm publish

package-lock.json

+40-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"pretest": "npm run lint && npm run clean && npm run instrument",
99
"test": "tap",
1010
"snap": "npm test -- --snapshot",
11+
"fix": "standard --fix",
1112
"posttest": "npm run report",
1213
"clean": "node ./npm-run-clean.js",
1314
"instrument": "node ./build-self-coverage.js",

tap-snapshots/test/nyc-integration.js.test.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ exports[`test/nyc-integration.js > TAP > passes configuration via environment va
888888
`
889889

890890
exports[`test/nyc-integration.js > TAP > recursive run does not throw > stdout 1`] = `
891-
891+
Buffer <2268 656c 6c6f 220d 0a "hello"..>
892892
`
893893

894894
exports[`test/nyc-integration.js > TAP > report and check should show coverage check along with report > stderr 1`] = `

test/helpers/run-nyc.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if ('APPDATA' in process.env) {
1313
envPath.APPDATA = process.env.APPDATA
1414
}
1515

16-
function sanitizeString (str, cwd, leavePathSep) {
16+
function sanitizeString(str, cwd, leavePathSep) {
1717
/*
1818
* File paths are different on different systems:
1919
* - make everything relative to cwd
@@ -31,7 +31,7 @@ function sanitizeString (str, cwd, leavePathSep) {
3131
return str
3232
}
3333

34-
async function runNYC ({ args, tempDir, leavePathSep, cwd = fixturesCLI, env = {} }) {
34+
async function runNYC({ args, tempDir, leavePathSep, cwd = fixturesCLI, env = {} }) {
3535
const runArgs = [nycBin].concat(tempDir ? ['--temp-dir', tempDir] : [], args)
3636
const { status, stderr, stdout } = await spawn(process.execPath, runArgs, {
3737
cwd: cwd,
@@ -47,8 +47,8 @@ async function runNYC ({ args, tempDir, leavePathSep, cwd = fixturesCLI, env = {
4747
stderr,
4848
stdout
4949
},
50-
stderr: sanitizeString(stderr, cwd, leavePathSep),
51-
stdout: sanitizeString(stdout, cwd, leavePathSep)
50+
stderr: sanitizeString(stderr.toString('utf8'), cwd, leavePathSep),
51+
stdout: sanitizeString(stdout.toString('utf8'), cwd, leavePathSep)
5252
}
5353
}
5454

test/helpers/test-success.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
const runNYC = require('./run-nyc')
44

5-
async function testSuccess (t, opts) {
5+
async function testSuccess(t, opts) {
66
const { status, stderr, stdout } = await runNYC({
77
tempDir: t.tempDir,
88
...opts
99
})
1010

1111
t.equal(status, 0)
1212
t.equal(stderr, '')
13-
console.info(stdout)
1413
t.matchSnapshot(stdout, 'stdout')
1514
}
1615

test/nyc-integration.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,8 @@ t.test('recursive run does not throw', t => testSuccess(t, {
591591
nycBin,
592592
process.execPath,
593593
nycBin,
594-
'true'
594+
'echo',
595+
'hello'
595596
],
596597
cwd: path.resolve(__dirname, 'fixtures/recursive-run')
597598
}))

0 commit comments

Comments
 (0)