@gcoredev/fastedge-test 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/fastedge-debug.js +38 -3
- package/dist/fastedge-cli/METADATA.json +1 -1
- package/dist/fastedge-cli/fastedge-run-darwin-arm64 +0 -0
- package/dist/fastedge-cli/fastedge-run-linux-x64 +0 -0
- package/dist/fastedge-cli/fastedge-run.exe +0 -0
- package/dist/lib/index.cjs +59 -28
- package/dist/lib/index.js +62 -29
- package/dist/lib/runner/HostFunctions.d.ts +1 -0
- package/dist/lib/test-framework/index.cjs +59 -28
- package/dist/lib/test-framework/index.js +61 -29
- package/dist/lib/utils/fastedge-cli.d.ts +36 -1
- package/dist/server.js +29 -29
- package/docs/DEBUGGER.md +24 -4
- package/docs/TEST_CONFIG.md +19 -19
- package/docs/TEST_FRAMEWORK.md +7 -7
- package/package.json +2 -2
package/docs/DEBUGGER.md
CHANGED
|
@@ -4,18 +4,20 @@ Runs the FastEdge debugger HTTP server, which hosts the web UI, REST API, and We
|
|
|
4
4
|
|
|
5
5
|
## CLI Usage
|
|
6
6
|
|
|
7
|
-
The package exposes a `fastedge-debug
|
|
7
|
+
The package exposes a single binary, `fastedge-debug`. Run it with `npx` after installing `@gcoredev/fastedge-test` in your project:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npx
|
|
10
|
+
npx fastedge-debug
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
If the package isn't installed yet, the explicit form fetches and runs it in one shot:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npx fastedge-debug
|
|
16
|
+
npx -p @gcoredev/fastedge-test fastedge-debug
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
> The shorthand `npx @gcoredev/fastedge-test` happens to work today because the package declares exactly one `bin` entry, and npx falls back to it when no name is given. Prefer the explicit `fastedge-debug` form — it stays correct if a second binary is ever added.
|
|
20
|
+
|
|
19
21
|
Once started, the server listens on `http://localhost:5179` by default and logs the bound address to stderr.
|
|
20
22
|
|
|
21
23
|
The CLI automatically discovers the workspace root by walking up from the current directory, looking first for an existing `.fastedge-debug/` directory, then for a `package.json` or `Cargo.toml`. The resolved root is used as the base for port file and configuration file placement. Pass a path as the first argument to anchor discovery to a specific starting location:
|
|
@@ -24,6 +26,24 @@ The CLI automatically discovers the workspace root by walking up from the curren
|
|
|
24
26
|
npx fastedge-debug /path/to/my-app
|
|
25
27
|
```
|
|
26
28
|
|
|
29
|
+
### `--project-dir <path>` (or `-C <path>`)
|
|
30
|
+
|
|
31
|
+
For setups where the CLI is invoked from a subdirectory of the project (for example, a Rust app with a `fastedge-test/` Node sandbox holding the debugger install), pass `--project-dir` to anchor workspace discovery at a different path:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# From inside fastedge-test/, point the debugger at the parent project root
|
|
35
|
+
cd fastedge-test
|
|
36
|
+
npx fastedge-debug --project-dir ..
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The flag accepts both `--project-dir <path>` and `--project-dir=<path>`. `-C` is a short alias. The resolved path then drives `WORKSPACE_PATH` and all config / fixture / dotenv resolution that flows from it, exactly as if the user had invoked the CLI from that directory. The flag is stripped before any remaining positional arguments are forwarded to the server, so you can combine it with a fixture path or other options:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx fastedge-debug --project-dir .. ../fixtures/scenario-1.test.json
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
When omitted, behavior is unchanged from prior versions — the positional argument or `process.cwd()` is used as the starting point.
|
|
46
|
+
|
|
27
47
|
## Programmatic Usage
|
|
28
48
|
|
|
29
49
|
Import `startServer` from the `./server` export to start the server from your own script or test setup:
|
package/docs/TEST_CONFIG.md
CHANGED
|
@@ -22,25 +22,25 @@ The config schema is a union of two variants selected by `appType`:
|
|
|
22
22
|
|
|
23
23
|
### Top-Level Fields
|
|
24
24
|
|
|
25
|
-
| JSON Path | Type | Required (Schema)
|
|
26
|
-
| ------------------ | --------- |
|
|
27
|
-
| `$schema` | `string` | No
|
|
28
|
-
| `description` | `string` | No
|
|
29
|
-
| `wasm` | `object` | No
|
|
30
|
-
| `wasm.path` | `string` | Yes (if `wasm` present)
|
|
31
|
-
| `wasm.description` | `string` | No
|
|
32
|
-
| `appType` | `string` | Yes (schema) / CDN has runtime default
|
|
33
|
-
| `request` | `object` | **Yes**
|
|
34
|
-
| `request.method` | `string` | Yes (schema) / runtime default
|
|
35
|
-
| `request.url` | `string` | **Yes** (CDN only)
|
|
36
|
-
| `request.path` | `string` | **Yes** (HTTP-WASM only)
|
|
37
|
-
| `request.headers` | `object` | Yes (schema) / runtime default
|
|
38
|
-
| `request.body` | `string` | Yes (schema) / runtime default
|
|
39
|
-
| `properties` | `object` | **Yes** (schema) / runtime default
|
|
40
|
-
| `dotenv` | `object` | No
|
|
41
|
-
| `dotenv.enabled` | `boolean` | No
|
|
42
|
-
| `dotenv.path` | `string` | No
|
|
43
|
-
| `httpPort` | `integer` | No
|
|
25
|
+
| JSON Path | Type | Required (Schema) | Default | Description |
|
|
26
|
+
| ------------------ | --------- | -------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
27
|
+
| `$schema` | `string` | No | — | URI pointing to the JSON Schema file for IDE autocompletion and validation. |
|
|
28
|
+
| `description` | `string` | No | — | Human-readable label for this test scenario. |
|
|
29
|
+
| `wasm` | `object` | No | — | WASM binary configuration. Required when running without a programmatic `wasmBuffer`. |
|
|
30
|
+
| `wasm.path` | `string` | Yes (if `wasm` present) | — | Path to the compiled `.wasm` binary, relative to the config file or absolute. |
|
|
31
|
+
| `wasm.description` | `string` | No | — | Human-readable label for the WASM binary. |
|
|
32
|
+
| `appType` | `string` | Yes (schema) / CDN has runtime default | `"proxy-wasm"` | App variant. `"proxy-wasm"` for CDN mode; `"http-wasm"` for HTTP mode. HTTP-WASM has no default. |
|
|
33
|
+
| `request` | `object` | **Yes** | — | Incoming HTTP request to simulate. |
|
|
34
|
+
| `request.method` | `string` | Yes (schema) / runtime default | `"GET"` | HTTP method (e.g. `"GET"`, `"POST"`). |
|
|
35
|
+
| `request.url` | `string` | **Yes** (CDN only) | — | Full URL for the simulated upstream request (e.g. `"https://example.com/api"`). CDN mode only. |
|
|
36
|
+
| `request.path` | `string` | **Yes** (HTTP-WASM only) | — | Request path (e.g. `"/api/submit"`). HTTP-WASM mode only. The WASM module acts as the origin server and receives only the path portion of the request. |
|
|
37
|
+
| `request.headers` | `object` | Yes (schema) / runtime default | `{}` | Key/value map of request headers. All keys and values must be strings. |
|
|
38
|
+
| `request.body` | `string` | Yes (schema) / runtime default | `""` | Request body as a plain string. Use an empty string for requests with no body. |
|
|
39
|
+
| `properties` | `object` | **Yes** (schema) / runtime default | `{}` | CDN property key/value pairs passed to the WASM execution context. Values may be any JSON type. |
|
|
40
|
+
| `dotenv` | `object` | No | — | Dotenv file loading configuration. |
|
|
41
|
+
| `dotenv.enabled` | `boolean` | No | — | Whether to load a `.env` file before execution. |
|
|
42
|
+
| `dotenv.path` | `string` | No | — | Path to the `.env` file. If omitted, resolves `.env` relative to the config file directory. |
|
|
43
|
+
| `httpPort` | `integer` | No | — | HTTP-WASM only. Pin the subprocess to a specific port (1024–65535) instead of dynamic allocation from the 8100–8199 pool. Throws if the port is busy. |
|
|
44
44
|
|
|
45
45
|
### Required vs. Default Distinction
|
|
46
46
|
|
package/docs/TEST_FRAMEWORK.md
CHANGED
|
@@ -195,13 +195,13 @@ interface RunnerConfig {
|
|
|
195
195
|
}
|
|
196
196
|
```
|
|
197
197
|
|
|
198
|
-
| Field | Type
|
|
199
|
-
| -------------------------------- |
|
|
200
|
-
| `dotenv.enabled` | `boolean`
|
|
201
|
-
| `dotenv.path` | `string`
|
|
202
|
-
| `enforceProductionPropertyRules` | `boolean`
|
|
203
|
-
| `runnerType` | `"http-wasm" \| "proxy-wasm"`
|
|
204
|
-
| `httpPort` | `number`
|
|
198
|
+
| Field | Type | Description |
|
|
199
|
+
| -------------------------------- | ------------------------------- | ------------------------------------------------------------------------- |
|
|
200
|
+
| `dotenv.enabled` | `boolean` | Enable dotenv loading |
|
|
201
|
+
| `dotenv.path` | `string` | Directory to load dotenv files from; defaults to process CWD when omitted |
|
|
202
|
+
| `enforceProductionPropertyRules` | `boolean` | Override production property enforcement for the runner; default `true` |
|
|
203
|
+
| `runnerType` | `"http-wasm" \| "proxy-wasm"` | Override automatic WASM type detection |
|
|
204
|
+
| `httpPort` | `number` | Pin the HTTP server to a specific port (HTTP WASM only; throws if in use) |
|
|
205
205
|
|
|
206
206
|
## Functions
|
|
207
207
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gcoredev/fastedge-test",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@assemblyscript/wasi-shim": "^0.1.0",
|
|
81
|
-
"@gcoredev/fastedge-sdk-js": "^2.2.
|
|
81
|
+
"@gcoredev/fastedge-sdk-js": "^2.2.3",
|
|
82
82
|
"@gcoredev/proxy-wasm-sdk-as": "^1.2.3",
|
|
83
83
|
"@types/ws": "^8.18.1",
|
|
84
84
|
"express": "^4.19.2",
|