Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b97b698
commit 6b01efc
Showing
20 changed files
with
3,644 additions
and
2,758 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v16.15.0 | ||
lts/hydrogen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,30 @@ | ||
export default { | ||
preset: "ts-jest/presets/default-esm", | ||
globals: { | ||
"ts-jest": { | ||
tsconfig: "test/tsconfig.json", | ||
useESM: true, | ||
}, | ||
}, | ||
moduleNameMapper: { | ||
'^@app/shared$': '<rootDir>/../shared/src/index.ts', | ||
"^@/(.*)$": "<rootDir>/src/$1", | ||
"^(\\.{1,2}/.*)\\.js$": "$1", | ||
}, | ||
testEnvironment: "miniflare", | ||
testEnvironmentOptions: { | ||
// Miniflare doesn't yet support the `main` field in `wrangler.toml` so we | ||
// need to explicitly tell it where our built worker is. We also need to | ||
// explicitly mark it as an ES module. | ||
scriptPath: "dist/index.mjs", | ||
modules: true, | ||
} | ||
import type { JestConfigWithTsJest } from "ts-jest"; | ||
const jestConfig: JestConfigWithTsJest = { | ||
testEnvironment: "miniflare", | ||
testEnvironmentOptions: { | ||
// Miniflare doesn't yet support the `main` field in `wrangler.toml` so we | ||
// need to explicitly tell it where our built worker is. We also need to | ||
// explicitly mark it as an ES module. | ||
scriptPath: "dist/index.mjs", | ||
modules: true, | ||
}, | ||
transform: { | ||
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest` | ||
// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest` | ||
"^.+\\.tsx?$": [ | ||
"ts-jest", | ||
{ | ||
tsconfig: "test/tsconfig.json", | ||
useESM: true, | ||
}, | ||
], | ||
}, | ||
moduleNameMapper: { | ||
"^@app/backend/(.*)$": "<rootDir>/src/$1", | ||
"^@app/shared$": "<rootDir>/../shared/src/index.ts", | ||
"^@/(.*)$": "<rootDir>/src/$1", | ||
"^(\\.{1,2}/.*)\\.js$": "$1", | ||
}, | ||
}; | ||
|
||
export default jestConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { handleRequest } from "@/index"; | ||
import { handleRequest } from "@app/backend/index"; | ||
|
||
test("should redirect to example page on no route match", async () => { | ||
const env = getMiniflareBindings(); | ||
const res = await handleRequest(new Request("http://localhost"), env); | ||
expect(res.status).toBe(200); | ||
expect(await res.text()).toBe("Hello World"); | ||
const env = getMiniflareBindings(); | ||
const res = await handleRequest(new Request("http://localhost"), env); | ||
expect(res.status).toBe(200); | ||
expect(await res.text()).toBe("Hello World"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,19 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "esnext", | ||
"module": "esnext", | ||
"lib": [ | ||
"esnext" | ||
], | ||
"types": [ | ||
"@cloudflare/workers-types" | ||
], | ||
"moduleResolution": "node", | ||
"strict": true, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"baseUrl": "./", | ||
"paths": { | ||
"@/*": [ | ||
"src/*" | ||
], | ||
"@app/shared": [ | ||
"./../shared/src/index.ts" | ||
] | ||
} | ||
"target": "esnext", | ||
"module": "esnext", | ||
"lib": ["esnext"], | ||
"types": ["@cloudflare/workers-types"], | ||
"moduleResolution": "node", | ||
"strict": true, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"baseUrl": "./", | ||
"paths": { | ||
"@app/backend/*": ["src/*"], | ||
"@app/shared": ["./../shared/src/index.ts"] | ||
} | ||
}, | ||
"include": [ | ||
"src/**/*", | ||
"bindings.d.ts" | ||
] | ||
} | ||
"include": ["src/**/*", "bindings.d.ts"] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.