Skip to content

Commit 90946d3

Browse files
committed
some updates
1 parent d283f7e commit 90946d3

File tree

4 files changed

+48
-30
lines changed

4 files changed

+48
-30
lines changed

Diff for: packages/backend/e2e.test.ts

+18-18
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import prWorkflowRunRequestedFixture from './fixtures/pr.workflow_run.requested.
77
import prPullRequestSynchronizeFixture from './fixtures/pr.pull_request.json'
88
import { simulation } from '@simulacrum/github-api-simulator'
99

10-
let server;
10+
let server: Awaited<ReturnType<ReturnType<typeof simulation>['listen']>>;
1111
let workerUrl: string;
1212

1313
let worker: UnstableDevWorker
@@ -30,7 +30,7 @@ beforeAll(async () => {
3030
worker = await unstable_dev(`${import.meta.dirname}/dist/_worker.js`, {
3131
config: `${import.meta.dirname}/wrangler.toml`,
3232
})
33-
const url = `${worker.proxyData.userWorkerUrl.protocol}//${worker.proxyData.userWorkerUrl.hostname}:${worker.proxyData.userWorkerUrl.port}`
33+
const url = `${worker.proxyData.userWorkerUrl.protocol}//${worker.proxyData.userWorkerUrl.hostname}:${worker.proxyData.userWorkerUrl.port}`
3434
console.log(url)
3535
workerUrl = url
3636
await ezSpawn.async(`pnpm cross-env TEST=true API_URL=${url} pnpm --filter=pkg-pr-new run build`, [], {
@@ -47,8 +47,8 @@ describe.sequential.each([
4747
[pushWorkflowRunInProgressFixture],
4848
[prWorkflowRunRequestedFixture, prPullRequestSynchronizeFixture]
4949
] as const)('webhook endpoints', (...fixture) => {
50-
const [{event, payload}, pr] = fixture
51-
const mode = pr ? 'pr' : 'commit'
50+
const [{ event, payload }, pr] = fixture
51+
const mode = pr ? 'pr' : 'commit'
5252
it(`handles ${mode} events`, async () => {
5353
// Send PR event if exists
5454
if (pr) {
@@ -93,18 +93,18 @@ describe.sequential.each([
9393
.map(([k, v]) => `${k}=${JSON.stringify(v)}`)
9494
.join(" ");
9595

96-
try {
97-
const process = await ezSpawn.async(`pnpm cross-env ${env} pnpm run -w publish:playgrounds`, [], {
98-
stdio: "overlapped",
99-
shell: true,
100-
});
101-
console.log(process.stdout)
96+
try {
97+
const process = await ezSpawn.async(`pnpm cross-env ${env} pnpm run -w publish:playgrounds`, [], {
98+
stdio: "overlapped",
99+
shell: true,
100+
});
101+
console.log(process.stdout)
102102

103-
} catch (e) {
104-
console.log(e)
103+
} catch (e) {
104+
console.log(e)
105+
106+
}
105107

106-
}
107-
108108
})
109109

110110
it(`serves and installs playground-a for ${mode}`, async () => {
@@ -127,7 +127,7 @@ describe.sequential.each([
127127
expect(shaBlobSize).toEqual(refBlobSize);
128128

129129
// Test installation
130-
const url = new URL(`/${owner}/${repo}/playground-a@${sha}?id=${Date.now()}`,workerUrl)
130+
const url = new URL(`/${owner}/${repo}/playground-a@${sha}?id=${Date.now()}`, workerUrl)
131131
const installProcess = await ezSpawn.async(`pnpm cross-env CI=true npx -f playground-a@${url}`, {
132132
stdio: "overlapped",
133133
shell: true,
@@ -144,7 +144,7 @@ describe.sequential.each([
144144
expect(response.status).toBe(200)
145145

146146
// Test installation
147-
const url = new URL(`/${owner}/${repo}/playground-b@${sha}?id=${Date.now()}`,workerUrl)
147+
const url = new URL(`/${owner}/${repo}/playground-b@${sha}?id=${Date.now()}`, workerUrl)
148148
const installProcess = await ezSpawn.async(`pnpm cross-env CI=true npx -f playground-b@${url}`, {
149149
stdio: "overlapped",
150150
shell: true,
@@ -184,13 +184,13 @@ describe('URL redirects', () => {
184184

185185
async function fetchWithRedirect(url: string, maxRedirects = 999): Promise<Response> {
186186
const response = await worker.fetch(url, { redirect: 'manual' })
187-
187+
188188
if (response.status >= 300 && response.status < 400 && maxRedirects > 0) {
189189
const location = response.headers.get('location')
190190
if (location) {
191191
return fetchWithRedirect(location, maxRedirects - 1)
192192
}
193193
}
194-
194+
195195
return response
196196
}

Diff for: packages/backend/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,8 @@
3636
"unstorage": "^1.10.2",
3737
"vitest": "2.1.8",
3838
"wrangler": "^3.57.1"
39+
},
40+
"dependencies": {
41+
"@simulacrum/foundation-simulator": "^0.3.0"
3942
}
4043
}

Diff for: packages/backend/vitest.config.ts

+11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
1+
import path from 'path';
12
import { defineConfig } from 'vitest/config'
23

4+
5+
const simulacrumFoundationSimulator = path.resolve(__dirname, "node_modules/@simulacrum/foundation-simulator/dist/cjs/index.js")
6+
console.log(simulacrumFoundationSimulator)
7+
38
export default defineConfig({
9+
resolve: {
10+
alias: {
11+
"@simulacrum/foundation-simulator": simulacrumFoundationSimulator
12+
},
13+
preserveSymlinks: true
14+
},
415
test: {
516
}
617
});

Diff for: pnpm-lock.yaml

+16-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)