-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
88 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
VITE_RUNTIME=http://localhost:1234 | ||
VITE_HOST=http://localhost:4321 |
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
VITE_RUNTIME=https://runno.run | ||
VITE_HOST=https://runno.dev |
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 |
---|---|---|
@@ -1,6 +1,47 @@ | ||
import "../lib/main"; | ||
import { headlessRunCode } from "../lib/main"; | ||
import { | ||
CompleteResult, | ||
CrashResult, | ||
Runtime, | ||
TerminatedResult, | ||
headlessRunCode, | ||
} from "../lib/main"; | ||
|
||
globalThis.Runno = { | ||
headlessRunCode, | ||
}; | ||
|
||
export type TestRunResult = | ||
| CrashResult | ||
| TerminatedResult | ||
| Omit<CompleteResult, "fs">; | ||
|
||
globalThis.test = { | ||
/** | ||
* Returning the fs in a test environment from playwright can result in a massive transfer | ||
* of files over the boundary between the headless browser and the playwright test runner. | ||
* This can cause tests to slow down significantly. | ||
* | ||
* So this wrapper strips out the `fs` from the result. | ||
*/ | ||
async headlessRunCode( | ||
runtime: Runtime, | ||
code: string, | ||
stdin?: string | ||
): Promise<TestRunResult> { | ||
const result = await headlessRunCode(runtime, code, stdin); | ||
|
||
if (result.resultType !== "complete") { | ||
return result; | ||
} | ||
|
||
return { | ||
resultType: "complete", | ||
stdin: result.stdin, | ||
stdout: result.stdout, | ||
stderr: result.stderr, | ||
tty: result.tty, | ||
exitCode: result.exitCode, | ||
}; | ||
}, | ||
}; |
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
VITE_RUNTIME=http://localhost:1234/ | ||
VITE_HOST=http://localhost:4321/ |
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
VITE_RUNTIME=https://runno.run/ | ||
VITE_HOST=https://runno.dev/ |
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 |
---|---|---|
@@ -1,4 +1,2 @@ | ||
/// <reference types="vite/client" /> | ||
interface ImportMetaEnv { | ||
VITE_RUNTIME: string; | ||
} | ||
interface ImportMetaEnv {} |