-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: move run-script banners to stderr when in json mode (#7439)
Fixes #7354
- Loading branch information
1 parent
7e349f4
commit bcc781a
Showing
5 changed files
with
45 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
const t = require('tap') | ||
const setup = require('./fixtures/setup.js') | ||
|
||
t.test('pack --json returns only json on stdout', async t => { | ||
const { npmLocal } = await setup(t) | ||
|
||
const { stderr, stdout } = await npmLocal('pack', '--json') | ||
|
||
t.match(stderr, /> npm@.* prepack\n/, 'stderr has banner') | ||
t.ok(JSON.parse(stdout), 'stdout can be parsed as json') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,13 +109,24 @@ Array [ | |
"name": "@myscope/test-package", | ||
"shasum": "{sha}", | ||
"size": "{size}", | ||
"unpackedSize": 50, | ||
"unpackedSize": 88, | ||
"version": "1.0.0", | ||
}, | ||
], | ||
] | ||
` | ||
|
||
exports[`test/lib/commands/pack.js TAP should log scoped package output as valid json > stderr has banners 1`] = ` | ||
Array [ | ||
String( | ||
> @myscope/[email protected] prepack | ||
> echo prepack! | ||
), | ||
] | ||
` | ||
|
||
exports[`test/lib/commands/pack.js TAP should pack current directory with no arguments > logs pack contents 1`] = ` | ||
Array [ | ||
"package: [email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters