-
-
Notifications
You must be signed in to change notification settings - Fork 104
chore: use tinyexec
#1213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sacrosanctic
wants to merge
5
commits into
sveltejs:version-1
Choose a base branch
from
sacrosanctic:tinyexec
base: version-1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
chore: use tinyexec
#1213
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
75a4404
drop in replacement
sacrosanctic cd65def
add run helper that defaults cwd to testOutputPath
sacrosanctic 8362453
refactor out `constructCommand`
sacrosanctic b06ccd4
add `isNodeError`
sacrosanctic 87c265c
reduce git diff
sacrosanctic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -88,9 +88,19 @@ describe('cli', () => { | |
| ...args | ||
| ]; | ||
|
|
||
| /** | ||
| * Same as `exec`. but `cwd` defaults to `testOutputPath` | ||
| */ | ||
| const run = (...params: Parameters<typeof exec>) => { | ||
| const [command, args, options = {}] = params; | ||
| options.nodeOptions ??= {}; | ||
| options.nodeOptions.cwd ??= testOutputPath; | ||
| return exec(command, args, options); | ||
| }; | ||
|
|
||
| // useful for debugging | ||
| // console.log(`command`, `node ${allArgs.join(' ')}`); | ||
| const result = await exec('node', allArgs, { nodeOptions: { stdio: 'pipe' } }); | ||
| const result = await exec('node', allArgs); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i wonder if this should be using |
||
|
|
||
| // cli finished well | ||
| expect( | ||
|
|
@@ -191,24 +201,18 @@ describe('cli', () => { | |
|
|
||
| if (projectName === 'create-with-all-addons' && process.platform !== 'win32') { | ||
| // the generated project lives inside this repo, so it must not join its workspace | ||
| const installResult = await exec( | ||
| 'pnpm', | ||
| ['install', '--no-frozen-lockfile', '--ignore-workspace'], | ||
| { nodeOptions: { stdio: 'pipe', cwd: testOutputPath } } | ||
| ); | ||
| const installResult = await run('pnpm', [ | ||
| 'install', | ||
| '--no-frozen-lockfile', | ||
| '--ignore-workspace' | ||
| ]); | ||
| expect( | ||
| installResult.exitCode, | ||
| `pnpm install failed:\n stdout: ${installResult.stdout}\n stderr: ${installResult.stderr}` | ||
| ).toBe(0); | ||
| await exec('pnpm', ['build'], { | ||
| nodeOptions: { stdio: 'pipe', cwd: testOutputPath } | ||
| }); | ||
| await exec('pnpm', ['auth:schema'], { | ||
| nodeOptions: { stdio: 'pipe', cwd: testOutputPath } | ||
| }); | ||
| const check = await exec('pnpm', ['check'], { | ||
| nodeOptions: { stdio: 'pipe', cwd: testOutputPath } | ||
| }); | ||
| await run('pnpm', ['build']); | ||
| await run('pnpm', ['auth:schema']); | ||
| const check = await run('pnpm', ['check']); | ||
| expect( | ||
| check.exitCode, | ||
| `svelte-check failed:\n stdout: ${check.stdout}\n stderr: ${check.stderr}` | ||
|
|
@@ -217,9 +221,6 @@ describe('cli', () => { | |
|
|
||
| // `kit@next` moves fast - only a real install/build/check catches options it removed | ||
| if (projectName === 'create-experimental-next' && process.platform !== 'win32') { | ||
| const run = (cmd: string, cmdArgs: string[]) => | ||
| exec(cmd, cmdArgs, { nodeOptions: { stdio: 'pipe', cwd: testOutputPath } }); | ||
|
|
||
| const install = await run('pnpm', [ | ||
| 'install', | ||
| '--no-frozen-lockfile', | ||
|
|
@@ -279,10 +280,8 @@ describe('cli', () => { | |
| for (const cmd of cmds) { | ||
| // use npm here so the install doesn't walk up into the monorepo's | ||
| // pnpm workspace and try to resolve packages from there | ||
| const res = await exec('npm', cmd, { | ||
| const res = await run('npm', cmd, { | ||
| nodeOptions: { | ||
| stdio: 'pipe', | ||
| cwd: testOutputPath, | ||
| env: { | ||
| ...process.env, | ||
| // allow npm under a repo whose packageManager is pnpm | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.