-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configure Jest package setups #11391
Merged
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
91f7efe
Bring back remix dev fixtures for unit tests
brophdawg11 0e48df0
Fix test using new fixture instead of stack fixture
brophdawg11 cae0eae
Remove remix init tests
brophdawg11 71b785c
Fix remaining unit tests
brophdawg11 01d97b3
Add missing dep
brophdawg11 08cd345
Remove watchPlugins
brophdawg11 d4eac83
Remove unused msw from remix-dev
brophdawg11 b1bd61c
Drop node 16
brophdawg11 7a099db
Fix node 20 snapshot
brophdawg11 7209066
Fix version check
brophdawg11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node_modules | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Brought over the |
||
|
||
/.cache | ||
/functions/\[\[path\]\].js | ||
/functions/\[\[path\]\].js.map | ||
/public/build | ||
.dev.vars |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
16.13.0 |
22 changes: 22 additions & 0 deletions
22
packages/remix-dev/__tests__/fixtures/cloudflare/README.md
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Welcome to Remix! | ||
|
||
- [Remix Docs](https://remix.run/docs) | ||
|
||
## Development | ||
|
||
You will be utilizing Wrangler for local development to emulate the Cloudflare runtime. This is already wired up in your package.json as the `dev` script: | ||
|
||
```sh | ||
# start the remix dev server and wrangler | ||
npm run dev | ||
``` | ||
|
||
Open up [http://127.0.0.1:8788](http://127.0.0.1:8788) and you should be ready to go! | ||
|
||
## Deployment | ||
|
||
Cloudflare Pages are currently only deployable through their Git provider integrations. | ||
|
||
If you don't already have an account, then [create a Cloudflare account here](https://dash.cloudflare.com/sign-up/pages) and after verifying your email address with Cloudflare, go to your dashboard and follow the [Cloudflare Pages deployment guide](https://developers.cloudflare.com/pages/framework-guides/deploy-anything). | ||
|
||
Configure the "Build command" should be set to `npm run build`, and the "Build output directory" should be set to `public`. |
33 changes: 33 additions & 0 deletions
33
packages/remix-dev/__tests__/fixtures/cloudflare/app/root.tsx
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import type { LinksFunction } from "@remix-run/cloudflare"; | ||
import { cssBundleHref } from "@remix-run/css-bundle"; | ||
import { | ||
Links, | ||
LiveReload, | ||
Meta, | ||
Outlet, | ||
Scripts, | ||
ScrollRestoration, | ||
} from "@remix-run/react"; | ||
|
||
export const links: LinksFunction = () => [ | ||
...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []), | ||
]; | ||
|
||
export default function App() { | ||
return ( | ||
<html lang="en"> | ||
<head> | ||
<meta charSet="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<Meta /> | ||
<Links /> | ||
</head> | ||
<body> | ||
<Outlet /> | ||
<ScrollRestoration /> | ||
<Scripts /> | ||
<LiveReload /> | ||
</body> | ||
</html> | ||
); | ||
} |
41 changes: 41 additions & 0 deletions
41
packages/remix-dev/__tests__/fixtures/cloudflare/app/routes/_index.tsx
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import type { MetaFunction } from "@remix-run/cloudflare"; | ||
|
||
export const meta: MetaFunction = () => { | ||
return [ | ||
{ title: "New Remix App" }, | ||
{ name: "description", content: "Welcome to Remix!" }, | ||
]; | ||
}; | ||
|
||
export default function Index() { | ||
return ( | ||
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.8" }}> | ||
<h1>Welcome to Remix</h1> | ||
<ul> | ||
<li> | ||
<a | ||
target="_blank" | ||
href="https://remix.run/tutorials/blog" | ||
rel="noreferrer" | ||
> | ||
15m Quickstart Blog Tutorial | ||
</a> | ||
</li> | ||
<li> | ||
<a | ||
target="_blank" | ||
href="https://remix.run/tutorials/jokes" | ||
rel="noreferrer" | ||
> | ||
Deep Dive Jokes App Tutorial | ||
</a> | ||
</li> | ||
<li> | ||
<a target="_blank" href="https://remix.run/docs" rel="noreferrer"> | ||
Remix Docs | ||
</a> | ||
</li> | ||
</ul> | ||
</div> | ||
); | ||
} |
32 changes: 32 additions & 0 deletions
32
packages/remix-dev/__tests__/fixtures/cloudflare/package.json
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"private": true, | ||
"sideEffects": false, | ||
"type": "module", | ||
"scripts": { | ||
"build": "remix build", | ||
"dev": "remix dev --manual -c \"npm run start\"", | ||
"start": "wrangler pages dev --compatibility-date=2023-06-21 ./public", | ||
"typecheck": "tsc" | ||
}, | ||
"dependencies": { | ||
"@remix-run/cloudflare": "*", | ||
"@remix-run/cloudflare-pages": "*", | ||
"@remix-run/css-bundle": "*", | ||
"@remix-run/react": "*", | ||
"isbot": "^4.1.0", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@cloudflare/workers-types": "^4.20230518.0", | ||
"@remix-run/dev": "*", | ||
"@types/react": "^18.2.20", | ||
"@types/react-dom": "^18.2.7", | ||
"eslint": "^8.38.0", | ||
"typescript": "^5.1.0", | ||
"wrangler": "^3.1.1" | ||
}, | ||
"engines": { | ||
"node": ">=18.0.0" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/remix-dev/__tests__/fixtures/cloudflare/public/_headers
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/favicon.ico | ||
Cache-Control: public, max-age=3600, s-maxage=3600 | ||
/build/* | ||
Cache-Control: public, max-age=31536000, immutable |
5 changes: 5 additions & 0 deletions
5
packages/remix-dev/__tests__/fixtures/cloudflare/public/_routes.json
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"version": 1, | ||
"include": ["/*"], | ||
"exclude": ["/favicon.ico", "/build/*"] | ||
} |
Binary file not shown.
14 changes: 14 additions & 0 deletions
14
packages/remix-dev/__tests__/fixtures/cloudflare/remix.config.js
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** @type {import('@remix-run/dev').AppConfig} */ | ||
export default { | ||
server: "./server.ts", | ||
serverBuildPath: "functions/[[path]].js", | ||
serverConditions: ["workerd", "worker", "browser"], | ||
serverDependenciesToBundle: "all", | ||
serverMainFields: ["browser", "module", "main"], | ||
serverMinify: true, | ||
serverModuleFormat: "esm", | ||
serverPlatform: "neutral", | ||
// appDirectory: "app", | ||
// assetsBuildDirectory: "public/build", | ||
// publicPath: "/build/", | ||
}; |
3 changes: 3 additions & 0 deletions
3
packages/remix-dev/__tests__/fixtures/cloudflare/remix.env.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/// <reference types="@remix-run/dev" /> | ||
/// <reference types="@remix-run/cloudflare" /> | ||
/// <reference types="@cloudflare/workers-types" /> |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { logDevReady } from "@remix-run/cloudflare"; | ||
import { createPagesFunctionHandler } from "@remix-run/cloudflare-pages"; | ||
import * as build from "@remix-run/dev/server-build"; | ||
|
||
if (process.env.NODE_ENV === "development") { | ||
logDevReady(build); | ||
} | ||
|
||
export const onRequest = createPagesFunctionHandler({ build }); |
22 changes: 22 additions & 0 deletions
22
packages/remix-dev/__tests__/fixtures/cloudflare/tsconfig.json
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"], | ||
"compilerOptions": { | ||
"lib": ["DOM", "DOM.Iterable", "ES2022"], | ||
"isolatedModules": true, | ||
"esModuleInterop": true, | ||
"jsx": "react-jsx", | ||
"moduleResolution": "Bundler", | ||
"resolveJsonModule": true, | ||
"target": "ES2022", | ||
"strict": true, | ||
"allowJs": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"baseUrl": ".", | ||
"paths": { | ||
"~/*": ["./app/*"] | ||
}, | ||
|
||
// Remix takes care of building everything in `remix build`. | ||
"noEmit": true | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules | ||
|
||
/.cache | ||
/build | ||
/public/build | ||
.env |
3 changes: 3 additions & 0 deletions
3
packages/remix-dev/__tests__/fixtures/deno/.vscode/extensions.json
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["denoland.vscode-deno"] | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/remix-dev/__tests__/fixtures/deno/.vscode/resolve_npm_imports.json
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"comment": [ | ||
"Resolve NPM imports for `packages/remix-deno`.", | ||
"This import map is used solely for the denoland.vscode-deno extension.", | ||
"Remix does not support import maps.", | ||
"Dependency management is done through `npm` and `node_modules/` instead.", | ||
"Deno-only dependencies may be imported via URL imports (without using import maps)." | ||
], | ||
"imports": { | ||
"@remix-run/css-bundle": "https://esm.sh/@remix-run/[email protected]", | ||
"// `@remix-run/deno` code is already a Deno module, so just get types for it directly from `node_modules/`": "", | ||
"@remix-run/deno": "../node_modules/@remix-run/deno/index.ts", | ||
"@remix-run/dev/server-build": "https://esm.sh/@remix-run/[email protected]/server-build", | ||
"@remix-run/react": "https://esm.sh/@remix-run/[email protected]", | ||
"@remix-run/server-runtime": "https://esm.sh/@remix-run/[email protected]", | ||
"isbot": "https://esm.sh/isbot@^4.1.0", | ||
"react": "https://esm.sh/react@^18.2.0", | ||
"react-dom": "https://esm.sh/react-dom@^18.2.0", | ||
"react-dom/client": "https://esm.sh/react-dom@^18.2.0/client", | ||
"react-dom/server": "https://esm.sh/react-dom@^18.2.0/server" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/remix-dev/__tests__/fixtures/deno/.vscode/settings.json
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"deno.enable": true, | ||
"deno.lint": true | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea what these were doing but took them out to get rid of these warnings on running jest
Feels smarter to decouple from jest-specific stuff too in anticipation of potentially moving to
vitest
or node's built-in test runner in the future