Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit 81bc22b

Browse files
authored
Merge pull request #1147 from Shopify/dependabot/npm_and_yarn/miniflare-3.20231218.2
Bump miniflare from 2.14.1 to 3.20231218.2
2 parents 8749da3 + 9fbd0f4 commit 81bc22b

File tree

9 files changed

+493
-129
lines changed

9 files changed

+493
-129
lines changed

packages/shopify-api/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.wrangler

packages/shopify-api/adapters/__e2etests__/test_apps/test-web-api-app.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,8 @@ function setRestClientRetryTime(time: number) {
4646

4747
/* eslint-disable-next-line import/no-anonymous-default-export */
4848
export default {
49-
async fetch(req: any, _env: any, _ctx: any) {
50-
const apiServerPort: number = parseInt(
51-
(globalThis as any).HTTP_SERVER_PORT || '3000',
52-
10,
53-
);
49+
async fetch(req: any, env: any, _ctx: any) {
50+
const apiServerPort: number = parseInt(env.HTTP_SERVER_PORT || '3000', 10);
5451
const apiServer = `localhost:${apiServerPort}`;
5552
const client = new RestClient({
5653
session: new Session({...session, shop: apiServer}),

packages/shopify-api/adapters/__e2etests__/test_environments.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ function allEnvironmentsReady(environments: E2eTestEnvironment[]): boolean {
3232
export async function runEnvironments(
3333
environments: E2eTestEnvironment[],
3434
): Promise<boolean> {
35+
// Give enough time for the servers to start listening
36+
await sleep(2000);
37+
3538
const maxAttempts = 5;
3639

3740
if (allEnvironmentsReady(environments)) return true;

packages/shopify-api/adapters/cf-worker/__tests__/cf-worker.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import {spawn} from 'child_process';
2+
import path from 'path';
23

34
import '..';
45

56
import '../../../runtime/__tests__/all.test';
67
import {runTests, E2eTestEnvironment} from '../../__e2etests__/e2e-runner.test';
78

89
const cfWorkerAppPort = '7777';
10+
// This value must match the one in ./wrangler.toml
911
const dummyServerPort = '7778';
1012

1113
const workerEnvironment: E2eTestEnvironment = {
@@ -15,12 +17,14 @@ const workerEnvironment: E2eTestEnvironment = {
1517
process: spawn(
1618
'yarn',
1719
[
18-
'miniflare',
19-
'--global',
20-
`HTTP_SERVER_PORT=${dummyServerPort}`,
20+
'wrangler',
21+
'dev',
22+
'-c',
23+
path.join(__dirname, './wrangler.toml'),
2124
'--port',
2225
`${cfWorkerAppPort}`,
23-
'--modules',
26+
'--inspector-port',
27+
'9249',
2428
'bundle/test-web-api-app.js',
2529
],
2630
{
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name="test_cf_worker"
2+
compatibility_date="2024-01-22"
3+
4+
send_metrics=false
5+
6+
[vars]
7+
HTTP_SERVER_PORT=7778

packages/shopify-api/adapters/web-api/__tests__/web-api.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import {spawn} from 'child_process';
2+
import path from 'path';
23

34
import '..';
45

56
import '../../../runtime/__tests__/all.test';
67
import {runTests, E2eTestEnvironment} from '../../__e2etests__/e2e-runner.test';
78

89
const webApiAppPort = '8888';
10+
// This value must match the one in ./wrangler.toml
911
const dummyServerPort = '8889';
1012

1113
// We should also try running this on a different environment that implements the Web API for better coverage.
@@ -16,12 +18,14 @@ const webApiEnvironment: E2eTestEnvironment = {
1618
process: spawn(
1719
'yarn',
1820
[
19-
'miniflare',
20-
'--global',
21-
`HTTP_SERVER_PORT=${dummyServerPort}`,
21+
'wrangler',
22+
'dev',
23+
'-c',
24+
path.join(__dirname, './wrangler.toml'),
2225
'--port',
2326
`${webApiAppPort}`,
24-
'--modules',
27+
'--inspector-port',
28+
'9259',
2529
'bundle/test-web-api-app.js',
2630
],
2731
{
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name="test_web_api"
2+
compatibility_date="2024-01-22"
3+
4+
send_metrics=false
5+
6+
[vars]
7+
HTTP_SERVER_PORT=8889

packages/shopify-api/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,11 @@
9090
"@types/uuid": "^9.0.0",
9191
"express": "^4.17.13",
9292
"jest-environment-miniflare": "^2.12.1",
93-
"miniflare": "^2.6.0",
93+
"miniflare": "^3.20231218.2",
9494
"rollup": "^2.79.1",
9595
"rollup-plugin-swc": "^0.2.1",
96-
"supertest": "^6.1.3"
96+
"supertest": "^6.1.3",
97+
"wrangler": "^3.24.0"
9798
},
9899
"files": [
99100
"**/*.d.ts",

0 commit comments

Comments
 (0)