@e2edev/e2e 0.9.0 → 0.10.0
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/README.md +2 -2
- package/dist/agent/act-validation.js +1 -1
- package/dist/agent/act-validation.js.map +1 -1
- package/dist/agent/act.d.ts +1 -0
- package/dist/agent/act.d.ts.map +1 -1
- package/dist/agent/act.js +27 -18
- package/dist/agent/act.js.map +1 -1
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +17 -12
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/invocation.d.ts +26 -6
- package/dist/agent/invocation.d.ts.map +1 -1
- package/dist/agent/invocation.js +9 -6
- package/dist/agent/invocation.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +3 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/engine-versions.json +1 -0
- package/dist/cli/init/engines.d.ts +11 -6
- package/dist/cli/init/engines.d.ts.map +1 -1
- package/dist/cli/init/engines.js +23 -4
- package/dist/cli/init/engines.js.map +1 -1
- package/dist/cli/init/scaffold.d.ts.map +1 -1
- package/dist/cli/init/scaffold.js +5 -3
- package/dist/cli/init/scaffold.js.map +1 -1
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +0 -6
- package/dist/cli/init.js.map +1 -1
- package/dist/collect/registry.d.ts.map +1 -1
- package/dist/collect/registry.js +3 -0
- package/dist/collect/registry.js.map +1 -1
- package/dist/collect/select.d.ts +2 -0
- package/dist/collect/select.d.ts.map +1 -1
- package/dist/collect/select.js +9 -0
- package/dist/collect/select.js.map +1 -1
- package/dist/config/agent.d.ts +3 -1
- package/dist/config/agent.d.ts.map +1 -1
- package/dist/config/agent.js +25 -24
- package/dist/config/agent.js.map +1 -1
- package/dist/config/esm-hooks.d.ts +28 -0
- package/dist/config/esm-hooks.d.ts.map +1 -0
- package/dist/config/esm-hooks.js +35 -0
- package/dist/config/esm-hooks.js.map +1 -0
- package/dist/config/load.d.ts +6 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +52 -5
- package/dist/config/load.js.map +1 -1
- package/dist/config/resolve.d.ts +7 -0
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resolve.js +53 -13
- package/dist/config/resolve.js.map +1 -1
- package/dist/engine/index.d.ts +8 -2
- package/dist/engine/index.d.ts.map +1 -1
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/surface.d.ts +2 -2
- package/dist/engine/surface.d.ts.map +1 -1
- package/dist/internal/atomic-write.d.ts +1 -1
- package/dist/internal/atomic-write.d.ts.map +1 -1
- package/dist/internal/atomic-write.js.map +1 -1
- package/dist/internal/package-version.d.ts +2 -0
- package/dist/internal/package-version.d.ts.map +1 -1
- package/dist/internal/package-version.js +9 -0
- package/dist/internal/package-version.js.map +1 -1
- package/dist/internal/redact.d.ts +12 -4
- package/dist/internal/redact.d.ts.map +1 -1
- package/dist/internal/redact.js +61 -12
- package/dist/internal/redact.js.map +1 -1
- package/dist/internal/zip.d.ts +32 -0
- package/dist/internal/zip.d.ts.map +1 -0
- package/dist/internal/zip.js +183 -0
- package/dist/internal/zip.js.map +1 -0
- package/dist/report/build.d.ts +2 -0
- package/dist/report/build.d.ts.map +1 -1
- package/dist/report/build.js.map +1 -1
- package/dist/report/list.d.ts.map +1 -1
- package/dist/report/list.js +2 -0
- package/dist/report/list.js.map +1 -1
- package/dist/run/artifacts.d.ts.map +1 -1
- package/dist/run/artifacts.js +8 -6
- package/dist/run/artifacts.js.map +1 -1
- package/dist/run/events.d.ts +2 -0
- package/dist/run/events.d.ts.map +1 -1
- package/dist/run/events.js.map +1 -1
- package/dist/run/execute.d.ts.map +1 -1
- package/dist/run/execute.js +29 -2
- package/dist/run/execute.js.map +1 -1
- package/dist/run/fixtures.d.ts +10 -1
- package/dist/run/fixtures.d.ts.map +1 -1
- package/dist/run/fixtures.js +39 -22
- package/dist/run/fixtures.js.map +1 -1
- package/dist/run/records.d.ts +8 -6
- package/dist/run/records.d.ts.map +1 -1
- package/dist/run/runner.d.ts +2 -0
- package/dist/run/runner.d.ts.map +1 -1
- package/dist/run/runner.js +3 -0
- package/dist/run/runner.js.map +1 -1
- package/dist/run/secrecy.d.ts +23 -0
- package/dist/run/secrecy.d.ts.map +1 -0
- package/dist/run/secrecy.js +22 -0
- package/dist/run/secrecy.js.map +1 -0
- package/dist/run/steps.d.ts +4 -0
- package/dist/run/steps.d.ts.map +1 -1
- package/dist/run/steps.js +1 -0
- package/dist/run/steps.js.map +1 -1
- package/dist/run/trace-redaction.d.ts +17 -0
- package/dist/run/trace-redaction.d.ts.map +1 -0
- package/dist/run/trace-redaction.js +148 -0
- package/dist/run/trace-redaction.js.map +1 -0
- package/dist/run/worker-models.d.ts +14 -14
- package/dist/run/worker-models.d.ts.map +1 -1
- package/dist/run/worker-models.js +41 -26
- package/dist/run/worker-models.js.map +1 -1
- package/dist/types.d.ts +22 -11
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/skills/e2e/SKILL.md +2 -2
- package/skills/e2e/references/agent.md +6 -6
- package/skills/e2e/references/debugging.md +1 -1
- package/skills/e2e/references/running.md +4 -0
- package/skills/e2e/references/setup.md +10 -9
- package/skills/e2e/references/writing-tests.md +1 -0
- package/dist/config/esm.d.ts +0 -4
- package/dist/config/esm.d.ts.map +0 -1
- package/dist/config/esm.js +0 -35
- package/dist/config/esm.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e2edev/e2e",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "SDK, runner, and CLI for agentic end-to-end testing",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"e2e",
|
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
"ajv-formats": "3.0.1",
|
|
74
74
|
"typescript": "7.0.2",
|
|
75
75
|
"vitest": "5.0.0",
|
|
76
|
-
"@e2edev/playwright": "0.
|
|
76
|
+
"@e2edev/playwright": "0.8.0"
|
|
77
77
|
},
|
|
78
78
|
"engines": {
|
|
79
79
|
"node": ">=22.12.0"
|
|
80
80
|
},
|
|
81
81
|
"scripts": {
|
|
82
|
-
"build": "node -e \"const fs=require('node:fs');for(const dir of ['dist','skills'])fs.rmSync(dir,{recursive:true,force:true});fs.cpSync('../../skills/e2e','skills/e2e',{recursive:true})\" && tsc --project tsconfig.build.json",
|
|
82
|
+
"build": "node -e \"const fs=require('node:fs');for(const dir of ['dist','skills'])fs.rmSync(dir,{recursive:true,force:true});fs.cpSync('../../skills/e2e','skills/e2e',{recursive:true})\" && tsc --project tsconfig.build.json && node -e \"const fs=require('node:fs');const versions=Object.fromEntries(['playwright','agent-device'].map((dir)=>['@e2edev/'+dir,JSON.parse(fs.readFileSync('../'+dir+'/package.json','utf8')).version]));fs.writeFileSync('dist/cli/init/engine-versions.json',JSON.stringify(versions)+'\\n')\"",
|
|
83
83
|
"typecheck": "tsc --noEmit",
|
|
84
84
|
"test": "vitest run",
|
|
85
85
|
"test:watch": "vitest",
|
package/skills/e2e/SKILL.md
CHANGED
|
@@ -29,7 +29,7 @@ export default {
|
|
|
29
29
|
},
|
|
30
30
|
],
|
|
31
31
|
// Only needed for agent.* steps; the model comes from E2E_MODEL.
|
|
32
|
-
|
|
32
|
+
agents: { default: createAgent({ system: 'You are a thorough QA agent. Verify every outcome on screen.' }) },
|
|
33
33
|
} satisfies E2EConfig;
|
|
34
34
|
```
|
|
35
35
|
|
|
@@ -90,7 +90,7 @@ one. Without them, the installed CLI prints the same text:
|
|
|
90
90
|
- Import `test`, `expect`, and `credentials` from `@e2edev/e2e`. A test that
|
|
91
91
|
uses the `web` fixture imports `test` from `@e2edev/playwright` instead: the
|
|
92
92
|
same runtime `test`, typed with `web`.
|
|
93
|
-
- Config and tests are ES modules
|
|
93
|
+
- Config and tests are ES modules and load as such whatever `package.json` sets as `type`.
|
|
94
94
|
- Nothing waits explicitly: queries poll, actions wait, `expect` retries.
|
|
95
95
|
Reads such as `textContent()` and `count()` do not retry, so assert with a
|
|
96
96
|
matcher when a value has to settle.
|
|
@@ -6,7 +6,7 @@ transcript between calls. Deterministic tests never load a model.
|
|
|
6
6
|
|
|
7
7
|
## Configure a model
|
|
8
8
|
|
|
9
|
-
There is no default model. Pick one of three shapes:
|
|
9
|
+
Agents live under `agents` by name; `default` is the one tests use, `e2e run --agent <name>` re-points that default, a test or describe pins one with `{ agent: 'name' }`, and any `agent.*` call can name one with `{ agent: 'name' }` (innermost wins). There is no default model. Pick one of three shapes for an entry:
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
12
|
// e2e.config.ts
|
|
@@ -14,13 +14,13 @@ import { createAgent } from '@e2edev/e2e/agent';
|
|
|
14
14
|
|
|
15
15
|
export default {
|
|
16
16
|
// 1. The built-in agent; the model comes from E2E_MODEL at run time.
|
|
17
|
-
|
|
17
|
+
agents: { default: createAgent({ system: 'You are a thorough QA agent. Verify every outcome on screen.' }) },
|
|
18
18
|
|
|
19
19
|
// 2. An options block: a gateway model string plus project vocabulary.
|
|
20
|
-
//
|
|
20
|
+
// agents: { default: { model: 'anthropic/claude-sonnet-4.5', context: 'A billing dashboard. Plans are Free, Team, and Pro.' } },
|
|
21
21
|
|
|
22
22
|
// 3. A live AI SDK model instance for a provider called directly.
|
|
23
|
-
//
|
|
23
|
+
// agents: { default: createAgent({ model: openai('gpt-5.4-mini') }) },
|
|
24
24
|
} satisfies E2EConfig;
|
|
25
25
|
```
|
|
26
26
|
|
|
@@ -30,7 +30,7 @@ E2E_MODEL=anthropic/claude-sonnet-4.5 E2E_MODEL_API_KEY=... npx --no-install e2e
|
|
|
30
30
|
|
|
31
31
|
- A `provider/model-id` string is routed through the Vercel AI Gateway; one
|
|
32
32
|
`E2E_MODEL_API_KEY` (or `AI_GATEWAY_API_KEY`) reaches every provider.
|
|
33
|
-
- With no `
|
|
33
|
+
- With no `agents` key at all, the built-in agent still runs as `default` and takes its
|
|
34
34
|
model from `E2E_MODEL`. Use `createAgent` for a `system` prompt, tools, or
|
|
35
35
|
a pinned model.
|
|
36
36
|
- `ai@^7` must be installed for any `agent.*` step; the runner loads it
|
|
@@ -40,7 +40,7 @@ E2E_MODEL=anthropic/claude-sonnet-4.5 E2E_MODEL_API_KEY=... npx --no-install e2e
|
|
|
40
40
|
- `visionModel` (or `E2E_VISION_MODEL`) serves the calls that send pixels.
|
|
41
41
|
- The model passed to `createAgent({ model })` is the one model for every
|
|
42
42
|
`agent.*` call, `act` and the judgments alike, and outranks `E2E_MODEL`.
|
|
43
|
-
An `
|
|
43
|
+
An agent `model` naming a different model is `INVALID_CONFIG`.
|
|
44
44
|
- Missing model or key: checked once per run when the first test acquires
|
|
45
45
|
the `agent` fixture. One run-level `MODEL_UNAVAILABLE` (exit 2) stops the
|
|
46
46
|
run; the remaining tests are skipped, not failed one by one.
|
|
@@ -23,7 +23,7 @@ jq '.run.results[] | select(.status != "passed") | .attempts[-1]
|
|
|
23
23
|
|
|
24
24
|
| Code | Usual cause | Fix |
|
|
25
25
|
| --- | --- | --- |
|
|
26
|
-
| `CONFIG_LOAD_FAILED`
|
|
26
|
+
| `CONFIG_LOAD_FAILED` | The config throws while loading, or imports a package that is not installed or a subpath that does not exist | The message names the cause: install the dependency, or fix the import it quotes |
|
|
27
27
|
| `INVALID_CONFIG` | Unknown key or a stale shape: a top-level `app`, `defineConfig`, a `backend` key, `json` combined with `list` reporters | Move app options into `playwright({ ... })`; use `satisfies E2EConfig`; the message names the key |
|
|
28
28
|
| `CONFIG_NOT_FOUND`, `CONFIG_AMBIGUOUS` | Wrong `--config` path; both `.ts` and `.mts` present | Fix the path; keep one config file |
|
|
29
29
|
| `NO_TESTS` | The glob or a positional matched nothing | The message names each positional that matched nothing. Check `tests` in the config and the `.e2e.ts` suffix |
|
|
@@ -20,6 +20,7 @@ npx --no-install e2e telemetry [disable|enable] # anonymous usage telemetry: sta
|
|
|
20
20
|
| `--target <ids>` | Comma-separated target names. Only selected targets start app commands and services; unknown names fail before startup. |
|
|
21
21
|
| `--tag <tag>` | Repeatable tag filter; `--tag-mode all` requires every tag. |
|
|
22
22
|
| `--headed` | Visible browser or simulator when the engine supports it. |
|
|
23
|
+
| `--agent <name>` | Run with another configured agent (`agents.<name>`); default is `agents.default`. |
|
|
23
24
|
| `--workers <n>`, `--retries <n>` | Override the resolved values. |
|
|
24
25
|
| `--reporter <ids>` | `list`, `json`, `junit`, comma-separated. `json` cannot combine with `list`. |
|
|
25
26
|
| `--artifacts <dir>` | Artifact root, default `.e2e/artifacts`. |
|
|
@@ -78,6 +79,9 @@ recorded flow is stale — `--no-cache` only skips the cache for one run.
|
|
|
78
79
|
- `junit`: `.e2e/junit.xml` beside the report, for CI test summaries.
|
|
79
80
|
Combine it with the terminal output: `--reporter list,junit`.
|
|
80
81
|
- `json`: the report document on stdout.
|
|
82
|
+
- `github()` from `@e2edev/github`: on GitHub Actions, one pull request comment per
|
|
83
|
+
run (edited on rerun) and the job summary; needs `pull-requests: write` and
|
|
84
|
+
`GITHUB_TOKEN` in the step's env.
|
|
81
85
|
- Artifacts (screenshots, Playwright traces, `--video` recordings, `--debug`
|
|
82
86
|
transcripts, downloads) live under `.e2e/artifacts/`; every path is
|
|
83
87
|
recorded in the report.
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
## Requirements
|
|
4
4
|
|
|
5
5
|
- Node.js 22.12 or newer.
|
|
6
|
-
- ES modules.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
`
|
|
10
|
-
the tests in their own ESM package directory.
|
|
6
|
+
- ES modules. e2e loads `.ts` config, tests, and helpers as ES modules
|
|
7
|
+
whatever the nearest `package.json` `type` says, so a CommonJS package (a
|
|
8
|
+
Next.js app, for instance) needs no change. Write them with `import`, never
|
|
9
|
+
`require` or `module.exports`.
|
|
11
10
|
- For browser tests, `@e2edev/playwright`. Missing browsers download when the
|
|
12
11
|
engine first boots. In CI install them up front:
|
|
13
12
|
`npx playwright install chromium --with-deps`.
|
|
@@ -69,7 +68,7 @@ export default {
|
|
|
69
68
|
},
|
|
70
69
|
],
|
|
71
70
|
// Only for agent.* steps. The model comes from E2E_MODEL unless set here.
|
|
72
|
-
|
|
71
|
+
agents: { default: createAgent({ system: 'You are a thorough QA agent. Verify every outcome on screen.' }) },
|
|
73
72
|
credentials: {
|
|
74
73
|
admin: { username: 'admin@example.test', password: process.env.ADMIN_PASSWORD ?? '' },
|
|
75
74
|
},
|
|
@@ -87,7 +86,7 @@ export default {
|
|
|
87
86
|
| `workers` | half the cores, `1` in CI | Test files run in parallel across workers, at most the `workers` the engine declares per target (a device target: one per device). |
|
|
88
87
|
| `reporters` | `['list']` | `list`, `json`, `junit`, and reporter objects (`{ name, onEvent?, onRunFinished? }`) that receive the finished run. `json` excludes `list`; `--reporter` keeps the objects. |
|
|
89
88
|
| `cache` | `'read-write'`, `'read-only'` in CI | The trace cache for `agent.act`; `'off'` disables it. |
|
|
90
|
-
| `
|
|
89
|
+
| `agents` | `{ default: built-in }` | Agents by name. `default` is what tests run with; `e2e run --agent <name>` runs with another. Each entry is `createAgent(...)`, an options block `{ model, context, visionModel, maxSteps, maxModelCalls, vision, providerOptions }`, or a custom `StepExecutor`. Omitted, the built-in agent runs with `E2E_MODEL`. |
|
|
91
90
|
| `credentials` | `{}` | Named `{ username, password, allowedOrigins? }` entries; `password` may be a function returning the value. |
|
|
92
91
|
| `screen.testIdAttribute` | `'data-testid'` | Attribute read by `getByTestId`. |
|
|
93
92
|
| `artifacts` | `['screenshot', 'trace']` | Kinds to keep (`screenshot`, `trace`, and the opt-in `video`), or `{ kinds, store, video }`; `video: { retain: 'on-failure' }` keeps only the recordings of attempts that did not pass. |
|
|
@@ -110,6 +109,8 @@ process, and identity. `playwright()` accepts:
|
|
|
110
109
|
| `browser` | `'chromium'` (default), `'firefox'`, `'webkit'`. |
|
|
111
110
|
| `viewport` | `{ width, height }`, default 1280x720. |
|
|
112
111
|
| `connect` | `{ cdpEndpoint }` to attach to a remote Chromium over CDP instead of launching. |
|
|
112
|
+
| `headers` | Request headers sent to allowed origins only (a Vercel `x-vercel-protection-bypass`, ngrok's `ngrok-skip-browser-warning`). Reaches every path onto the page, `agent.act` included; turns the browser HTTP cache off and blocks service workers. |
|
|
113
|
+
| `basicAuth` | `{ username, password }` answering a `401` challenge from an allowed origin; never sent to any other. |
|
|
113
114
|
|
|
114
115
|
Two browsers are two targets sharing one app declaration:
|
|
115
116
|
|
|
@@ -185,7 +186,7 @@ or read the address from the environment:
|
|
|
185
186
|
| --- | --- |
|
|
186
187
|
| `E2E_MODEL` | `provider/model-id` for `agent.*` steps when the config sets no model. Routed through the Vercel AI Gateway. |
|
|
187
188
|
| `E2E_MODEL_API_KEY` | Credential for that model. `AI_GATEWAY_API_KEY` is the fallback. |
|
|
188
|
-
| `E2E_MODEL_ENDPOINT` | Any OpenAI-compatible endpoint URL for that model; the gateway is the default. HTTPS unless loopback. `
|
|
189
|
+
| `E2E_MODEL_ENDPOINT` | Any OpenAI-compatible endpoint URL for that model; the gateway is the default. HTTPS unless loopback. The agent's `model.endpoint` wins. |
|
|
189
190
|
| `E2E_VISION_MODEL` | Model for calls with `vision`; falls back to the main model. |
|
|
190
191
|
| `E2E_USER_<NAME>_USERNAME`, `E2E_USER_<NAME>_PASSWORD` | Override `credentials.<name>`. `<NAME>` is the credential name uppercased, other characters as `_`. |
|
|
191
192
|
| `CI` | Turns on CI defaults: `retries: 1`, `workers: 1`, `test.only` rejected, cache read-only, `reuseExisting` ignored. |
|
|
@@ -209,7 +210,7 @@ const iphone = agentDevice({ platform: 'ios', app: 'com.example.app' });
|
|
|
209
210
|
export default {
|
|
210
211
|
targets: [{ engine: iphone }],
|
|
211
212
|
workers: 1,
|
|
212
|
-
|
|
213
|
+
agents: { default: createAgent({ tools: agentDeviceTools(iphone) }) },
|
|
213
214
|
} satisfies E2EConfig;
|
|
214
215
|
```
|
|
215
216
|
|
|
@@ -65,6 +65,7 @@ test.setup('sign in', { sessions: ['admin'] }, async ({ app, screen, session })
|
|
|
65
65
|
| `requires` | `[]` | Capabilities the engine must contribute, e.g. `['web']`. Otherwise the test is skipped at selection instead of failing with `UNSUPPORTED_CAPABILITY`. |
|
|
66
66
|
| `session` | unset | Restore state saved by a setup test. |
|
|
67
67
|
| `agentContext` | unset | Extra context for `agent.*` calls in this test or group. |
|
|
68
|
+
| `agent` | the run's agent | Pin the test or group to a configured agent (`agents.<name>`). Innermost wins; `agent.act(..., { agent })` can name another for one call. |
|
|
68
69
|
| `serial` | `false` | Groups only. Members share one app state, run in order on one worker, and retry as a whole. Inside, per-member `retries`, `session`, `platforms`, `requires`, and `skip` are errors. |
|
|
69
70
|
|
|
70
71
|
Hook order follows nesting, not position: outer `beforeEach` first, inner
|
package/dist/config/esm.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/** Package-scope diagnostics for TypeScript config and test entry points. */
|
|
2
|
-
/** Explains how to opt a `.ts` entry point's package into ESM when required. */
|
|
3
|
-
export declare function esmPackageHint(modulePath: string): string | undefined;
|
|
4
|
-
//# sourceMappingURL=esm.d.ts.map
|
package/dist/config/esm.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"esm.d.ts","sourceRoot":"","sources":["../../src/config/esm.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAK7E,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA2BrE"}
|
package/dist/config/esm.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/** Package-scope diagnostics for TypeScript config and test entry points. */
|
|
2
|
-
import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
/** Explains how to opt a `.ts` entry point's package into ESM when required. */
|
|
5
|
-
export function esmPackageHint(modulePath) {
|
|
6
|
-
const filename = existsSync(modulePath) ? realpathSync(modulePath) : modulePath;
|
|
7
|
-
if (path.extname(filename) !== '.ts')
|
|
8
|
-
return undefined;
|
|
9
|
-
let dir = path.dirname(filename);
|
|
10
|
-
for (;;) {
|
|
11
|
-
const manifestPath = path.join(dir, 'package.json');
|
|
12
|
-
if (existsSync(manifestPath)) {
|
|
13
|
-
let manifest;
|
|
14
|
-
try {
|
|
15
|
-
manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
// Leave malformed or unreadable manifests to the loader's own diagnostic.
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
if (typeof manifest !== 'object' || manifest === null || Array.isArray(manifest)) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
if ('type' in manifest && manifest.type === 'module')
|
|
25
|
-
return undefined;
|
|
26
|
-
return `e2e requires ES modules for .ts config and test files, but ${manifestPath} does not set "type": "module". To opt this package into ESM, run npm pkg set type=module from ${dir}. This also changes how existing .js files in the package are interpreted.`;
|
|
27
|
-
}
|
|
28
|
-
const parent = path.dirname(dir);
|
|
29
|
-
if (parent === dir || path.basename(parent) === 'node_modules')
|
|
30
|
-
break;
|
|
31
|
-
dir = parent;
|
|
32
|
-
}
|
|
33
|
-
return `e2e requires ES modules for .ts config and test files. Create a package.json with "type": "module" in ${path.dirname(filename)}, or run e2e init in the project directory.`;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=esm.js.map
|
package/dist/config/esm.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"esm.js","sourceRoot":"","sources":["../../src/config/esm.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,gFAAgF;AAChF,MAAM,UAAU,cAAc,CAAC,UAAkB;IAC/C,MAAM,QAAQ,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;IAChF,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,KAAK;QAAE,OAAO,SAAS,CAAC;IAEvD,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjC,SAAS,CAAC;QACR,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QACpD,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAC7B,IAAI,QAAiB,CAAC;YACtB,IAAI,CAAC;gBACH,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;YAC5D,CAAC;YAAC,MAAM,CAAC;gBACP,0EAA0E;gBAC1E,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACjF,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,IAAI,MAAM,IAAI,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ;gBAAE,OAAO,SAAS,CAAC;YACvE,OAAO,8DAA8D,YAAY,kGAAkG,GAAG,4EAA4E,CAAC;QACrQ,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,cAAc;YAAE,MAAM;QACtE,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IAED,OAAO,yGAAyG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,6CAA6C,CAAC;AACtL,CAAC"}
|