Skip to content

Commit

Permalink
Use nano-spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 8, 2024
1 parent 2aa1db8 commit 3570575
Show file tree
Hide file tree
Showing 25 changed files with 1,116 additions and 1,117 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
},
"devDependencies": {
"@ehmicky/dev-tasks": "^3.0.11",
"execa": "^9.3.1",
"get-bin-path": "^11.0.0",
"nano-spawn": "^0.1.0",
"test-each": "^7.0.0"
},
"engines": {
Expand Down
11 changes: 5 additions & 6 deletions src/helpers/cli.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { execaNode } from 'execa'
import spawn from 'nano-spawn'
import { getBinPath } from 'get-bin-path'

const BINARY_PATH = getBinPath()
Expand All @@ -7,11 +7,10 @@ const BINARY_PATH = getBinPath()
export const callCli = async (command, ...args) => {
const argsA = args.map(stringifyCliArg)

const { stdout, stderr, exitCode } = await execaNode(
await BINARY_PATH,
[command, ...argsA],
{ reject: false },
)
const [{ reason, value: { stdout, stderr, exitCode } = reason }] =
await Promise.allSettled([
spawn('node', [await BINARY_PATH, command, ...argsA]),
])

const stderrA = stderr.replace(HELP_MESSAGE_REGEXP, 'Help message')

Expand Down
68 changes: 34 additions & 34 deletions src/snapshots/build/src/functions/contain.test.js.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Snapshot report for `src/functions/contain.test.js`
# Snapshot report for `build/src/functions/contain.test.js`

The actual snapshot is saved in `contain.test.js.snap`.

Expand Down Expand Up @@ -65,7 +65,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down Expand Up @@ -97,7 +97,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand All @@ -113,7 +113,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down Expand Up @@ -177,7 +177,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand All @@ -193,7 +193,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down Expand Up @@ -241,7 +241,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down Expand Up @@ -289,7 +289,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down Expand Up @@ -321,7 +321,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down Expand Up @@ -353,7 +353,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down Expand Up @@ -385,7 +385,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down Expand Up @@ -433,7 +433,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand All @@ -449,7 +449,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down Expand Up @@ -497,7 +497,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand All @@ -513,7 +513,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down Expand Up @@ -561,7 +561,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand All @@ -577,7 +577,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down Expand Up @@ -609,7 +609,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down Expand Up @@ -673,7 +673,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down Expand Up @@ -705,7 +705,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand All @@ -721,7 +721,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand All @@ -737,7 +737,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down Expand Up @@ -801,7 +801,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down Expand Up @@ -881,7 +881,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand All @@ -897,7 +897,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand All @@ -913,7 +913,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand All @@ -929,7 +929,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand All @@ -945,7 +945,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand All @@ -961,7 +961,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down Expand Up @@ -1025,7 +1025,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand All @@ -1041,7 +1041,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down Expand Up @@ -1137,7 +1137,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand All @@ -1153,7 +1153,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand All @@ -1169,7 +1169,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
exitCode: 0,
exitCode: undefined,
stderr: '',
stdout: '',
}
Expand Down
Binary file modified src/snapshots/build/src/functions/contain.test.js.snap
Binary file not shown.
Loading

0 comments on commit 3570575

Please sign in to comment.