-
Notifications
You must be signed in to change notification settings - Fork 42
Add speedtest command #864
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,6 +72,26 @@ export async function version(binPath: string): Promise<string> { | |
| return json.version; | ||
| } | ||
|
|
||
| /** | ||
| * Run a speed test against the specified workspace and return the raw output. | ||
| * Throw if unable to execute the binary. | ||
| */ | ||
| export async function speedtest( | ||
| binPath: string, | ||
| globalFlags: string[], | ||
| workspaceName: string, | ||
| options: { signal?: AbortSignal; duration?: string }, | ||
|
Collaborator
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 don't love mixing two different kinds of options, one for args and one for the execution itself 🤔 Actually maybe inline this, it's very similar to the one in |
||
| ): Promise<string> { | ||
| const args = [...globalFlags, "speedtest", workspaceName, "--output", "json"]; | ||
| if (options.duration) { | ||
| args.push("-t", options.duration); | ||
| } | ||
| const result = await promisify(execFile)(binPath, args, { | ||
| signal: options.signal, | ||
| }); | ||
| return result.stdout; | ||
| } | ||
|
|
||
| export interface RemovalResult { | ||
| fileName: string; | ||
| error: unknown; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| /* eslint-env node */ | ||
| // Prints each argument on its own line, so tests can verify exact args. | ||
| process.argv.slice(2).forEach((arg) => console.log(arg)); |
Uh oh!
There was an error while loading. Please reload this page.