@essential-apps/shopify-test-runner 1.0.13 → 1.0.15
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/dist/edge/edgeProxy.d.ts.map +1 -1
- package/dist/edge/edgeProxy.js +18 -12
- package/dist/edge/edgeProxy.js.map +1 -1
- package/dist/playwright/baseConfig.d.ts +2 -2
- package/dist/playwright/baseConfig.js +1 -1
- package/dist/probes/runProbe.js +2 -2
- package/dist/probes/runProbe.js.map +1 -1
- package/dist/probes/types.d.ts +1 -1
- package/dist/scripts/captureAuth.js +1 -1
- package/dist/scripts/captureContracts.js +5 -5
- package/dist/scripts/captureContracts.js.map +1 -1
- package/dist/scripts/captureRestContracts.js +4 -4
- package/dist/scripts/captureRestContracts.js.map +1 -1
- package/dist/scripts/installApp.js +2 -2
- package/dist/scripts/installApp.js.map +1 -1
- package/dist/scripts/runOffline.js +2 -2
- package/dist/scripts/runOffline.js.map +1 -1
- package/dist/scripts/runOfflineFullTests.js +12 -13
- package/dist/scripts/runOfflineFullTests.js.map +1 -1
- package/dist/scripts/runTests.js +2 -2
- package/dist/scripts/runTests.js.map +1 -1
- package/dist/scripts/runVm.js +1 -1
- package/dist/scripts/verifyContracts.js +2 -2
- package/dist/scripts/verifyContracts.js.map +1 -1
- package/dist/scripts/verifyRestContracts.js +1 -1
- package/dist/scripts/verifyRestContracts.js.map +1 -1
- package/package.json +7 -7
- package/src/edge/edgeProxy.ts +19 -12
- package/src/playwright/baseConfig.ts +2 -2
- package/src/probes/runProbe.ts +2 -2
- package/src/probes/types.ts +1 -1
- package/src/scripts/captureAuth.ts +1 -1
- package/src/scripts/captureContracts.ts +5 -5
- package/src/scripts/captureRestContracts.ts +4 -4
- package/src/scripts/installApp.ts +2 -2
- package/src/scripts/runOffline.ts +2 -2
- package/src/scripts/runOfflineFullTests.ts +12 -13
- package/src/scripts/runTests.ts +2 -2
- package/src/scripts/runVm.ts +1 -1
- package/src/scripts/verifyContracts.ts +2 -2
- package/src/scripts/verifyRestContracts.ts +1 -1
|
@@ -259,7 +259,7 @@ async function waitForReady(url: string, timeoutMs: number): Promise<void> {
|
|
|
259
259
|
* Configure the container for offline mode: write Shopify hostname
|
|
260
260
|
* entries into /etc/hosts and install the edge proxy's self-signed
|
|
261
261
|
* cert as a system CA. The container entrypoint
|
|
262
|
-
* (tests/
|
|
262
|
+
* (tests/offline/docker/entrypoint.sh) does the same thing when
|
|
263
263
|
* node_modules is warm at container start; on a cold cache, the
|
|
264
264
|
* entrypoint can't (cert file doesn't exist yet) and this is the
|
|
265
265
|
* post-install backstop.
|
|
@@ -589,14 +589,14 @@ async function main(): Promise<void> {
|
|
|
589
589
|
'[runOfflineFull] FATAL: must run inside the offline container.\n' +
|
|
590
590
|
' Run: `npm run test:offline-full` (which invokes runDockerOffline.ts)\n' +
|
|
591
591
|
' If you are seeing this from inside what should be a container, the\n' +
|
|
592
|
-
" entrypoint script (tests/
|
|
592
|
+
" entrypoint script (tests/offline/docker/entrypoint.sh) didn't run or\n" +
|
|
593
593
|
" didn't export TEST_IN_CONTAINER=true.",
|
|
594
594
|
);
|
|
595
595
|
process.exit(2);
|
|
596
596
|
}
|
|
597
597
|
|
|
598
598
|
// ── Offline-mode setup (idempotent, survives cold cache) ──
|
|
599
|
-
// The container entrypoint (tests/
|
|
599
|
+
// The container entrypoint (tests/offline/docker/entrypoint.sh) does
|
|
600
600
|
// this when node_modules is already populated at container start.
|
|
601
601
|
// But on a FRESH Linux node_modules cache, the entrypoint runs
|
|
602
602
|
// BEFORE `npm install`, so the cert isn't on disk yet and the
|
|
@@ -616,10 +616,9 @@ async function main(): Promise<void> {
|
|
|
616
616
|
// hosts-file redirect. Inside a single network namespace only one
|
|
617
617
|
// bind to :443 wins — N>1 here fails with EADDRINUSE.
|
|
618
618
|
//
|
|
619
|
-
//
|
|
620
|
-
//
|
|
621
|
-
//
|
|
622
|
-
// invokes; set `TEST_PARALLEL_VMS=N` to scale.
|
|
619
|
+
// Real parallelism would need one microVM per shard (each with its
|
|
620
|
+
// own network ns, so :443 is per-VM). That isolated-per-VM runner
|
|
621
|
+
// is not built today.
|
|
623
622
|
//
|
|
624
623
|
// Set `TEST_OFFLINE_WORKERS=N` (≥2) here only when the supervisor's
|
|
625
624
|
// edge-proxy-per-shard collision is fixed; today it's a footgun.
|
|
@@ -643,7 +642,7 @@ async function main(): Promise<void> {
|
|
|
643
642
|
const scopes = process.env['SCOPES'] ?? 'write_products,read_products,write_discounts,read_discounts';
|
|
644
643
|
const playwrightConfig =
|
|
645
644
|
process.env['TEST_PLAYWRIGHT_CONFIG'] ??
|
|
646
|
-
'tests/
|
|
645
|
+
'tests/offline/playwright.offline-full.config.ts';
|
|
647
646
|
const isChildShard = shardIndex !== null;
|
|
648
647
|
// Backend port: shard k uses BASE + (k-1); single-worker uses BASE.
|
|
649
648
|
const baseBackendPort = Number(process.env['TEST_OFFLINE_BACKEND_PORT'] ?? '8181');
|
|
@@ -811,7 +810,7 @@ async function main(): Promise<void> {
|
|
|
811
810
|
//
|
|
812
811
|
// The browser and Node both reach this proxy at port 443 because
|
|
813
812
|
// the container's `/etc/hosts` maps Shopify hostnames to 127.0.0.1
|
|
814
|
-
// (kernel-layer DNS rewrite — see tests/
|
|
813
|
+
// (kernel-layer DNS rewrite — see tests/offline/docker/entrypoint.sh),
|
|
815
814
|
// and the edge's self-signed cert is installed as a system CA so
|
|
816
815
|
// TLS validates natively. No Chromium flags or Node monkey-patches
|
|
817
816
|
// required — DNS + TLS work the same way they would against real
|
|
@@ -893,7 +892,7 @@ async function main(): Promise<void> {
|
|
|
893
892
|
// connects locally (via the same neon ws-proxy) and so a real analytics
|
|
894
893
|
// DB is never reachable from an offline run. Harmless for apps without it.
|
|
895
894
|
// The non-prisma tables this client expects are created by the optional
|
|
896
|
-
// extra-schema hook below (tests/
|
|
895
|
+
// extra-schema hook below (tests/offline/offline-extra-schema.sql).
|
|
897
896
|
ANALYTICS_DATABASE_URL: dbConn,
|
|
898
897
|
// Auth wired to the mock JWT secret — shopify-app-remix uses this
|
|
899
898
|
// to verify session JWTs minted by the mock App Bridge.
|
|
@@ -969,13 +968,13 @@ async function main(): Promise<void> {
|
|
|
969
968
|
// prisma-managed tables; an app may also read a second database with a
|
|
970
969
|
// different ORM (e.g. drizzle for analytics) whose tables prisma doesn't
|
|
971
970
|
// know about. If the consuming app ships
|
|
972
|
-
// tests/
|
|
971
|
+
// tests/offline/offline-extra-schema.sql, apply it to the SAME offline
|
|
973
972
|
// Postgres (idempotent CREATE TABLE IF NOT EXISTS), via psql with the
|
|
974
973
|
// MSW-loader-stripped env, exactly like migrate. Skipped if absent, so it's
|
|
975
974
|
// a no-op for apps that don't need it.
|
|
976
|
-
const extraSchema = resolve(process.cwd(), 'tests/
|
|
975
|
+
const extraSchema = resolve(process.cwd(), 'tests/offline/offline-extra-schema.sql');
|
|
977
976
|
if (existsSync(extraSchema)) {
|
|
978
|
-
console.log('[runOfflineFull] applying extra schema (tests/
|
|
977
|
+
console.log('[runOfflineFull] applying extra schema (tests/offline/offline-extra-schema.sql)…');
|
|
979
978
|
execSync(
|
|
980
979
|
`psql -h ${PG_HOST} -p ${PG_PORT} -d ${dbName} -v ON_ERROR_STOP=1 -f ${JSON.stringify(extraSchema)}`,
|
|
981
980
|
{ stdio: 'inherit', env: prismaEnv },
|
package/src/scripts/runTests.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* Conventions (overridable via env, but Phase 0 just hardcodes them):
|
|
15
15
|
* - Backend: `npx vite --port <port> --strictPort --host 0.0.0.0`
|
|
16
16
|
* - Schema migration: `npx prisma migrate deploy`
|
|
17
|
-
* - Playwright config at `tests/
|
|
17
|
+
* - Playwright config at `tests/online/playwright.config.ts`
|
|
18
18
|
* - DB name prefix: derived from the consuming app's package name
|
|
19
19
|
*
|
|
20
20
|
* Env vars forwarded into the backend process (hermetic — we do NOT
|
|
@@ -258,7 +258,7 @@ async function main(): Promise<void> {
|
|
|
258
258
|
// already in process.env (via the --env-file=.env.test flag on
|
|
259
259
|
// the runner).
|
|
260
260
|
const playwrightConfig =
|
|
261
|
-
process.env['TEST_PLAYWRIGHT_CONFIG'] ?? 'tests/
|
|
261
|
+
process.env['TEST_PLAYWRIGHT_CONFIG'] ?? 'tests/online/playwright.config.ts';
|
|
262
262
|
// PLAYWRIGHT_GREP narrows the run to tests matching a regex
|
|
263
263
|
// (Playwright's --grep). Documented as the env-var entry point in
|
|
264
264
|
// runOffline.ts; mirror it here so the vm path
|
package/src/scripts/runVm.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* Architecture:
|
|
18
18
|
* - Image: `essential-apps/shopify-test-vm:latest` baked
|
|
19
|
-
* via `tests/
|
|
19
|
+
* via `tests/offline/docker/Dockerfile.vm` in the consuming
|
|
20
20
|
* app (the equivalent of `Dockerfile` for libkrun). Auto-saved as
|
|
21
21
|
* a local OCI archive on first invocation via `prepareOciArchive`.
|
|
22
22
|
* - Bind mounts (virtio-fs DAX):
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* verifyContracts — the offline-side conformance check.
|
|
4
4
|
*
|
|
5
|
-
* Reads every vendored contract under `tests/
|
|
5
|
+
* Reads every vendored contract under `tests/offline/contracts/<api>/`,
|
|
6
6
|
* re-runs its operation against an in-process offline mock with the
|
|
7
7
|
* vendored `variables`, and asserts the response equals the
|
|
8
8
|
* vendored `response`. Any drift fails the check.
|
|
@@ -67,7 +67,7 @@ function parseArgs(): Args {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
if (!out.contractsDir) {
|
|
70
|
-
out.contractsDir = resolve(out.cwd, 'tests/
|
|
70
|
+
out.contractsDir = resolve(out.cwd, 'tests/offline/contracts', out.api);
|
|
71
71
|
} else {
|
|
72
72
|
out.contractsDir = resolve(out.cwd, out.contractsDir);
|
|
73
73
|
}
|
|
@@ -53,7 +53,7 @@ function parseArgs(): Args {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
if (!out.contractsDir) {
|
|
56
|
-
out.contractsDir = resolve(out.cwd, 'tests/
|
|
56
|
+
out.contractsDir = resolve(out.cwd, 'tests/offline/contracts/admin-rest');
|
|
57
57
|
} else {
|
|
58
58
|
out.contractsDir = resolve(out.cwd, out.contractsDir);
|
|
59
59
|
}
|