-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
19
commits into
sveltejs:main
Choose a base branch
from
sacrosanctic:tinyexec
base: main
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
19 commits
Select commit
Hold shift + click to select a range
fdcf48f
drop in replacement
sacrosanctic c791d83
add run helper that defaults cwd to testOutputPath
sacrosanctic 2115be4
refactor out `constructCommand`
sacrosanctic 1fc25b7
refactor to no throw
sacrosanctic 21bef99
`tinyexec` doesn't throw by default
sacrosanctic d7d20f9
clean up
sacrosanctic 696efaa
every `exec` on this page should `throw`?
sacrosanctic f44f36e
not sure if this is a one to one refactor
sacrosanctic 390a6ea
lint
sacrosanctic 78030c6
fix
sacrosanctic e48f361
fix
sacrosanctic 20674ce
nit
sacrosanctic 764cf6a
rerun test
sacrosanctic ea6eb58
Update packages/sv/src/core/verifiers.ts
sacrosanctic 6901b16
adjust throws
sacrosanctic 584df66
lint
sacrosanctic 4b0773d
Clarify where error properties come from
sacrosanctic 9b31da4
throw
sacrosanctic 1ab1830
more throws
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
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 |
|---|---|---|
|
|
@@ -96,9 +96,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( | ||
|
|
@@ -199,24 +209,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}` | ||
|
|
@@ -225,9 +229,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', | ||
|
|
@@ -287,10 +288,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
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.