You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A JavaScript library that rpovides helpers for testing Shopify Functions WASM (WebAssembly) modules. This library provides four core utilities: `loadFixture`, `validateFixture`, `buildFunction`, and `runFunction`.
3
+
A JavaScript library that provides helpers for testing Shopify Functions WASM (WebAssembly) modules. This library provides utilities for loading fixtures, validating test assets, building functions, and running functions.
Validates a fixture to ensure it has the correct structure.
55
-
56
-
**Parameters:**
57
-
-`fixture`: The fixture data to validate
126
+
### Core Functions
58
127
59
-
**Returns:** ValidationResult object with `isValid` boolean and `errors` array
128
+
-[`loadFixture`](./src/methods/load-fixture.ts) - Load a fixture file from the specified path
129
+
-[`loadSchema`](./src/methods/load-schema.ts) - Load a GraphQL schema from a file
130
+
-[`loadInputQuery`](./src/methods/load-input-query.ts) - Load and parse a GraphQL input query
131
+
-[`validateTestAssets`](./src/methods/validate-test-assets.ts) - Validate test assets including input query, fixture input/output, and query-fixture match
132
+
-[`buildFunction`](./src/methods/build-function.ts) - Build a Shopify function using the Shopify CLI
133
+
-[`runFunction`](./src/methods/run-function.ts) - Run a Shopify function using the Shopify CLI
60
134
61
-
#### `buildFunction(functionPath?)`
62
-
Builds a Shopify function using the Shopify CLI.
63
-
64
-
**Parameters:**
65
-
-`functionPath` (optional): Path to the function directory. If not provided, will auto-detect from current working directory.
66
-
67
-
**Returns:** Promise that resolves to build result object with `success`, `output`, and `error` properties.
-`exportName`: The export name of the function to run
74
-
-`input`: The input data to pass to the function
75
-
-`functionPath` (optional): Path to the function directory. If not provided, will auto-detect from current working directory.
76
-
77
-
**Returns:** Promise that resolves to result object with `result` and `error` properties.
78
-
79
-
**Note:** Both functions will automatically detect the function directory by looking for `shopify.function.toml` in common locations (current directory, src/, functions/, extensions/). You can also provide a specific path if needed.
135
+
See [wasm-testing-helpers.ts](./src/wasm-testing-helpers.ts) for all exported types.
0 commit comments