Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 86a532e

Browse filesBrowse files
BridgeJS: Add helper SetupOptionsFn type to test.d.ts
1 parent 3b305b7 commit 86a532e
Copy full SHA for 86a532e

3 files changed

+12-2Lines changed: 12 additions & 2 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Plugins/PackageToJS/Templates/test.d.ts‎

Copy file name to clipboardExpand all lines: Plugins/PackageToJS/Templates/test.d.ts
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import type { InstantiateOptions, instantiate } from "./instantiate";
22

3+
export type SetupOptionsFn = (
4+
options: InstantiateOptions,
5+
context: {
6+
isMainThread: boolean,
7+
}
8+
) => Promise<InstantiateOptions>
9+
310
export function testBrowser(
411
options: {
512
preludeScript?: string,
Collapse file

‎Plugins/PackageToJS/Templates/test.js‎

Copy file name to clipboardExpand all lines: Plugins/PackageToJS/Templates/test.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ export async function testBrowserInPage(options, processInfo) {
157157
});
158158

159159
const { instantiate } = await import("./instantiate.js");
160+
/** @type {import('./test.d.ts').SetupOptionsFn} */
160161
let setupOptions = (options, _) => { return options };
161162
if (processInfo.preludeScript) {
162163
const prelude = await import(processInfo.preludeScript);
Collapse file

‎Tests/prelude.mjs‎

Copy file name to clipboardExpand all lines: Tests/prelude.mjs
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
/** @type {import('../.build/plugins/PackageToJS/outputs/PackageTests/test.d.ts').SetupOptions} */
2-
export function setupOptions(options, context) {
1+
// @ts-check
2+
3+
/** @type {import('../.build/plugins/PackageToJS/outputs/PackageTests/test.d.ts').SetupOptionsFn} */
4+
export async function setupOptions(options, context) {
35
Error.stackTraceLimit = 100;
46
setupTestGlobals(globalThis);
57
return {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.