Compare commits
No commits in common. "16015491e41f803641e809313f84380c2ebaaec1" and "c24cfa0b4c920471184e20e9dd00d70989e5d173" have entirely different histories.
16015491e4
...
c24cfa0b4c
|
|
@ -1,10 +0,0 @@
|
||||||
name: Test
|
|
||||||
run-name: Test?
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- run: npm install && npm run test
|
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
.env
|
.env
|
||||||
data/
|
data/
|
||||||
node_modules/
|
node_modules/
|
||||||
build/
|
|
||||||
public/
|
public/
|
||||||
/test-results/
|
build/
|
||||||
/playwright-report/
|
|
||||||
/blob-report/
|
|
||||||
/playwright/.cache/
|
|
||||||
19
.prettierrc
19
.prettierrc
|
|
@ -1,19 +0,0 @@
|
||||||
{
|
|
||||||
"trailingComma": "es5",
|
|
||||||
"tabWidth": 4,
|
|
||||||
"semi": false,
|
|
||||||
"singleQuote": false,
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": [
|
|
||||||
"*.test.ts",
|
|
||||||
"*.test.js",
|
|
||||||
"*.spec.ts",
|
|
||||||
"*.spec.js"
|
|
||||||
],
|
|
||||||
"options": {
|
|
||||||
"maxLineLength": 9999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
31
.swcrc
31
.swcrc
|
|
@ -1,31 +0,0 @@
|
||||||
{
|
|
||||||
"jsc": {
|
|
||||||
"target": "es2022",
|
|
||||||
"parser": {
|
|
||||||
"syntax": "typescript",
|
|
||||||
"tsx": true,
|
|
||||||
"decorators": false,
|
|
||||||
"dynamicImport": false
|
|
||||||
},
|
|
||||||
"transform": {
|
|
||||||
"react": {
|
|
||||||
"pragma": "React.createElement",
|
|
||||||
"pragmaFrag": "React.Fragment",
|
|
||||||
"throwIfNamespace": true,
|
|
||||||
"development": false,
|
|
||||||
"useBuiltins": false,
|
|
||||||
"runtime": "automatic"
|
|
||||||
},
|
|
||||||
"hidden": {
|
|
||||||
"jest": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"module": {
|
|
||||||
"type": "commonjs",
|
|
||||||
"strict": false,
|
|
||||||
"strictMode": true,
|
|
||||||
"lazy": false,
|
|
||||||
"noInterop": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -11,7 +11,6 @@ import { createReadableStreamFromReadable } from "@remix-run/node";
|
||||||
import { RemixServer } from "@remix-run/react";
|
import { RemixServer } from "@remix-run/react";
|
||||||
import { isbot } from "isbot";
|
import { isbot } from "isbot";
|
||||||
import { renderToPipeableStream } from "react-dom/server";
|
import { renderToPipeableStream } from "react-dom/server";
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
const ABORT_DELAY = 5_000;
|
const ABORT_DELAY = 5_000;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
/// <reference lib="WebWorker" />
|
|
||||||
|
|
||||||
export {};
|
|
||||||
|
|
||||||
declare let self: ServiceWorkerGlobalScope;
|
|
||||||
|
|
||||||
self.addEventListener('install', event => {
|
|
||||||
console.log('Service worker installed');
|
|
||||||
|
|
||||||
event.waitUntil(self.skipWaiting());
|
|
||||||
});
|
|
||||||
|
|
||||||
self.addEventListener('activate', event => {
|
|
||||||
console.log('Service worker activated');
|
|
||||||
|
|
||||||
event.waitUntil(self.clients.claim());
|
|
||||||
});
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 65 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 299 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 58 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 947 B |
Binary file not shown.
|
Before Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB |
|
|
@ -1 +0,0 @@
|
||||||
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
import { act, render, screen, waitFor } from '@testing-library/react'
|
|
||||||
import MatchMediaMock from 'jest-matchmedia-mock';
|
|
||||||
|
|
||||||
import { createRemixStub, RemixStubProps } from "@remix-run/testing"
|
|
||||||
import App from './root'
|
|
||||||
import React from 'react'
|
|
||||||
let RemixStub: (props: RemixStubProps) => React.JSX.Element
|
|
||||||
|
|
||||||
describe("root", () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
RemixStub = createRemixStub([
|
|
||||||
{
|
|
||||||
path: "/",
|
|
||||||
meta: () => ([]),
|
|
||||||
links: () => ([]),
|
|
||||||
loader: () => ({ isSupported: true}),
|
|
||||||
Component: App
|
|
||||||
}
|
|
||||||
])
|
|
||||||
})
|
|
||||||
|
|
||||||
let matchMedia: MatchMediaMock
|
|
||||||
|
|
||||||
beforeAll(() => {
|
|
||||||
matchMedia = new MatchMediaMock();
|
|
||||||
})
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
matchMedia.clear();
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("when user is on iOS", () => {
|
|
||||||
describe("version 16.4 or higher", () => {
|
|
||||||
describe("and tack up now is not already installed on their device", () => {
|
|
||||||
test("they are instructed to install tack up now", async () => {
|
|
||||||
render(<RemixStub/>)
|
|
||||||
|
|
||||||
await waitFor(() => screen.findByText<HTMLElement>(/Install/), { timeout: 2000 })
|
|
||||||
|
|
||||||
expect(true).toBe(true)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
48
app/root.tsx
48
app/root.tsx
|
|
@ -1,33 +1,29 @@
|
||||||
import {
|
import {
|
||||||
Links,
|
Links,
|
||||||
Meta,
|
Meta,
|
||||||
Outlet,
|
Outlet,
|
||||||
Scripts,
|
Scripts,
|
||||||
ScrollRestoration,
|
ScrollRestoration,
|
||||||
} from "@remix-run/react"
|
} from "@remix-run/react";
|
||||||
import React from "react"
|
|
||||||
|
|
||||||
export function Layout({ children }: { children: React.ReactNode }) {
|
export function Layout({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charSet="utf-8" />
|
<meta charSet="utf-8" />
|
||||||
<meta
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
name="viewport"
|
<Meta />
|
||||||
content="width=device-width, initial-scale=1"
|
<Links />
|
||||||
/>
|
</head>
|
||||||
<Meta />
|
<body>
|
||||||
<Links />
|
{children}
|
||||||
</head>
|
<ScrollRestoration />
|
||||||
<body>
|
<Scripts />
|
||||||
{children}
|
</body>
|
||||||
<ScrollRestoration />
|
</html>
|
||||||
<Scripts />
|
);
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
return <Outlet/>
|
return <Outlet />;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,4 @@
|
||||||
import { json, type LoaderFunctionArgs, type MetaFunction } from "@remix-run/node";
|
import type { MetaFunction } from "@remix-run/node";
|
||||||
import { useLoaderData } from "@remix-run/react";
|
|
||||||
import React, { Suspense, useEffect } from "react";
|
|
||||||
import UAParser from "ua-parser-js"
|
|
||||||
import versionAtLeast from "semver/functions/gte"
|
|
||||||
import coerceSemver from "semver/functions/coerce"
|
|
||||||
|
|
||||||
export const meta: MetaFunction = () => {
|
export const meta: MetaFunction = () => {
|
||||||
return [
|
return [
|
||||||
|
|
@ -12,41 +7,12 @@ export const meta: MetaFunction = () => {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|
||||||
const userAgent = request.headers.get("user-agent")
|
|
||||||
const os = new UAParser(userAgent ?? "").getOS()
|
|
||||||
const isSupported =
|
|
||||||
os.name !== "iOS" ||
|
|
||||||
versionAtLeast(coerceSemver(os.version) ?? "0.0.0", "16.4.0")
|
|
||||||
|
|
||||||
return json({ isSupported })
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function Index() {
|
export default function Index() {
|
||||||
|
|
||||||
const { isSupported } = useLoaderData<typeof loader>()
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.8" }}>
|
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.8" }}>
|
||||||
<Suspense>
|
<h1>WHOAH! A WEBSITE</h1>
|
||||||
<LandingMessage isSupported={isSupported}/>
|
<div>Hey check it out!</div>
|
||||||
</Suspense>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function LandingMessage({ isSupported }: { isSupported: boolean }) {
|
|
||||||
|
|
||||||
if (typeof window === "undefined") return <div>Loading</div>
|
|
||||||
|
|
||||||
const isRunningPWA = ("standalone" in navigator && navigator.standalone as boolean) || matchMedia("(dislay-mode: standalone)").matches
|
|
||||||
const notificationsEnabled = "Notification" in window && window.Notification.permission === "granted"
|
|
||||||
const message = isRunningPWA && !notificationsEnabled
|
|
||||||
? "Enable notifications"
|
|
||||||
: isSupported
|
|
||||||
? "Install Tack Up Now!"
|
|
||||||
: "Sorry, your device doesn't support Tack Up Now! :("
|
|
||||||
|
|
||||||
return <div><div>{message}</div></div>
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ services:
|
||||||
database:
|
database:
|
||||||
image: postgres
|
image: postgres
|
||||||
ports:
|
ports:
|
||||||
- "5433:5432"
|
- "0.0.0.0:5433:5432"
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
|
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
|
|
|
||||||
|
|
@ -1,76 +0,0 @@
|
||||||
import { test, expect } from "@playwright/test"
|
|
||||||
|
|
||||||
const { describe, beforeEach, skip, use } = test
|
|
||||||
|
|
||||||
function webkitOnly() {
|
|
||||||
beforeEach(async ({ browserName }) => {
|
|
||||||
if (browserName !== "webkit") skip()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
describe("when user is on iOS", () => {
|
|
||||||
webkitOnly()
|
|
||||||
|
|
||||||
describe("version 16.4 or higher", () => {
|
|
||||||
use({
|
|
||||||
userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 16_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Mobile/15E148 Safari/604.1",
|
|
||||||
})
|
|
||||||
|
|
||||||
test("and tack up now is not running as a PWA, they are instructed to install tack up now", async ({ page }) => {
|
|
||||||
await page.goto("/")
|
|
||||||
|
|
||||||
const installText = await page.getByText(/Install Tack Up Now!/)
|
|
||||||
|
|
||||||
await expect(installText).toBeAttached()
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("and tack up now is running as a PWA", () => {
|
|
||||||
|
|
||||||
beforeEach(async ({ page }) => {
|
|
||||||
await page.addInitScript(() => (window.navigator as any)["standalone"] = true)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("and notifications aren't enabled, they are asked to enable notifications", async ({ page, browser }) => {
|
|
||||||
await page.addInitScript(() => (Object.defineProperty(window.Notification, "permission", {value: "default", writable: true })))
|
|
||||||
await page.goto("/")
|
|
||||||
|
|
||||||
const notificationText = await page.getByText(/Enable notifications/)
|
|
||||||
|
|
||||||
await expect(notificationText).toBeAttached()
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("and notifications are enabled", () => {
|
|
||||||
|
|
||||||
beforeEach(async ({ page }) => {
|
|
||||||
await page.addInitScript(() => {
|
|
||||||
window.Notification = window.Notification ?? {}
|
|
||||||
Object.defineProperty(window.Notification, "permission", {value: "granted", writable: true })
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
test("they aren't asked to enable notifications", async ({ page }) => {
|
|
||||||
await page.goto("/")
|
|
||||||
await page.evaluate(async () => await navigator.serviceWorker.ready)
|
|
||||||
|
|
||||||
const notificationText = await page.getByText(/Enable notifications/)
|
|
||||||
|
|
||||||
await expect(notificationText).not.toBeAttached()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("version 16.3 and under", () => {
|
|
||||||
use({
|
|
||||||
userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 16_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Mobile/15E148 Safari/604.1",
|
|
||||||
})
|
|
||||||
|
|
||||||
test("version 16.3 and under they are informed that their iOS version isn't supported", async ({ page }) => {
|
|
||||||
await page.goto("/")
|
|
||||||
|
|
||||||
const sorryText = await page.getByText(/Sorry/)
|
|
||||||
|
|
||||||
await expect(sorryText).toBeVisible()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
const ignorePatterns = [
|
|
||||||
"\\/build\\/",
|
|
||||||
"\\/coverage\\/",
|
|
||||||
"\\/\\.vscode\\/",
|
|
||||||
"\\/\\.tmp\\/",
|
|
||||||
"\\/\\.cache\\/",
|
|
||||||
"data",
|
|
||||||
"e2e"
|
|
||||||
];
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
moduleNameMapper: {
|
|
||||||
"^@web3-storage/multipart-parser$": require.resolve(
|
|
||||||
"@web3-storage/multipart-parser"
|
|
||||||
),
|
|
||||||
},
|
|
||||||
modulePathIgnorePatterns: ignorePatterns,
|
|
||||||
transform: {
|
|
||||||
"\\.[jt]sx?$": require.resolve("./transform"),
|
|
||||||
},
|
|
||||||
transformIgnorePatterns: [],
|
|
||||||
watchPathIgnorePatterns: [...ignorePatterns, "\\/node_modules\\/"],
|
|
||||||
watchPlugins: [
|
|
||||||
require.resolve("jest-watch-typeahead/filename"),
|
|
||||||
require.resolve("jest-watch-typeahead/testname"),
|
|
||||||
],
|
|
||||||
displayName: "testing",
|
|
||||||
setupFiles: [],
|
|
||||||
testEnvironment: "jsdom",
|
|
||||||
setupFilesAfterEnv: ["./setupTests.ts", "@testing-library/jest-dom"],
|
|
||||||
};
|
|
||||||
File diff suppressed because it is too large
Load Diff
34
package.json
34
package.json
|
|
@ -9,11 +9,9 @@
|
||||||
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
|
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
|
||||||
"start": "remix-serve ./build/server/index.js",
|
"start": "remix-serve ./build/server/index.js",
|
||||||
"typecheck": "tsc",
|
"typecheck": "tsc",
|
||||||
"watch": "jest --watch --config=jest.config.ts",
|
"test": "jest --watch"
|
||||||
"test": "jest --config=jest.config.ts"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@remix-pwa/worker-runtime": "^2.1.4",
|
|
||||||
"@remix-run/express": "^2.9.1",
|
"@remix-run/express": "^2.9.1",
|
||||||
"@remix-run/node": "^2.9.0",
|
"@remix-run/node": "^2.9.0",
|
||||||
"@remix-run/react": "^2.9.0",
|
"@remix-run/react": "^2.9.0",
|
||||||
|
|
@ -22,38 +20,20 @@
|
||||||
"express": "^4.19.2",
|
"express": "^4.19.2",
|
||||||
"isbot": "^4.1.0",
|
"isbot": "^4.1.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0"
|
||||||
"remix-utils": "^7.6.0",
|
|
||||||
"semver": "^7.6.3",
|
|
||||||
"ua-parser-js": "^1.0.39"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.24.5",
|
|
||||||
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
|
|
||||||
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
|
|
||||||
"@babel/preset-env": "^7.24.5",
|
|
||||||
"@babel/preset-react": "^7.24.1",
|
|
||||||
"@babel/preset-typescript": "^7.24.1",
|
|
||||||
"@playwright/test": "^1.44.1",
|
|
||||||
"@remix-pwa/dev": "^3.1.0",
|
|
||||||
"@remix-run/dev": "^2.9.0",
|
"@remix-run/dev": "^2.9.0",
|
||||||
"@remix-run/testing": "^2.9.1",
|
"@remix-run/testing": "^2.9.1",
|
||||||
"@swc/core": "^1.5.7",
|
|
||||||
"@swc/jest": "^0.2.36",
|
|
||||||
"@testing-library/jest-dom": "^6.4.5",
|
|
||||||
"@testing-library/react": "^15.0.4",
|
"@testing-library/react": "^15.0.4",
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
"@types/jest": "^29.5.12",
|
|
||||||
"@types/node": "^20.14.5",
|
|
||||||
"@types/react": "^18.2.20",
|
"@types/react": "^18.2.20",
|
||||||
"@types/react-dom": "^18.2.7",
|
"@types/react-dom": "^18.2.7",
|
||||||
"@types/semver": "^7.5.8",
|
|
||||||
"@types/supertest": "^6.0.2",
|
"@types/supertest": "^6.0.2",
|
||||||
"@types/ua-parser-js": "^0.7.39",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
||||||
"@typescript-eslint/parser": "^6.7.4",
|
"@typescript-eslint/parser": "^6.7.4",
|
||||||
"babel-jest": "^29.7.0",
|
"chai": "^4.4.1",
|
||||||
"babel-plugin-transform-remove-console": "^6.9.4",
|
"chai-as-promised": "^7.1.1",
|
||||||
"eslint": "^8.38.0",
|
"eslint": "^8.38.0",
|
||||||
"eslint-import-resolver-typescript": "^3.6.1",
|
"eslint-import-resolver-typescript": "^3.6.1",
|
||||||
"eslint-plugin-import": "^2.28.1",
|
"eslint-plugin-import": "^2.28.1",
|
||||||
|
|
@ -61,10 +41,8 @@
|
||||||
"eslint-plugin-react": "^7.33.2",
|
"eslint-plugin-react": "^7.33.2",
|
||||||
"eslint-plugin-react-hooks": "^4.6.0",
|
"eslint-plugin-react-hooks": "^4.6.0",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"jest-environment-jsdom": "^29.7.0",
|
"sinon": "^17.0.1",
|
||||||
"jest-matchmedia-mock": "^1.1.0",
|
"sinon-chai": "^3.7.0",
|
||||||
"jest-watch-typeahead": "^2.2.2",
|
|
||||||
"prettier": "^3.3.3",
|
|
||||||
"supertest": "^7.0.0",
|
"supertest": "^7.0.0",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "^5.1.6",
|
"typescript": "^5.1.6",
|
||||||
|
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
||||||
import { defineConfig, devices } from '@playwright/test';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read environment variables from file.
|
|
||||||
* https://github.com/motdotla/dotenv
|
|
||||||
*/
|
|
||||||
// require('dotenv').config();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* See https://playwright.dev/docs/test-configuration.
|
|
||||||
*/
|
|
||||||
export default defineConfig({
|
|
||||||
testDir: './e2e',
|
|
||||||
testMatch: "*.spec.ts",
|
|
||||||
/* Run tests in files in parallel */
|
|
||||||
fullyParallel: true,
|
|
||||||
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
||||||
forbidOnly: !!process.env.CI,
|
|
||||||
/* Retry on CI only */
|
|
||||||
retries: process.env.CI ? 2 : 0,
|
|
||||||
/* Opt out of parallel tests on CI. */
|
|
||||||
workers: process.env.CI ? 1 : undefined,
|
|
||||||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
|
||||||
reporter: 'html',
|
|
||||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
||||||
use: {
|
|
||||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
|
||||||
baseURL: 'http://127.0.0.1:5173',
|
|
||||||
ignoreHTTPSErrors: true,
|
|
||||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
||||||
trace: 'on-first-retry',
|
|
||||||
},
|
|
||||||
|
|
||||||
/* Configure projects for major browsers */
|
|
||||||
projects: [
|
|
||||||
{
|
|
||||||
name: 'chromium',
|
|
||||||
use: { ...devices['Desktop Chrome'] },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'firefox',
|
|
||||||
use: { ...devices['Desktop Firefox'] },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'webkit',
|
|
||||||
use: { ...devices['Desktop Safari'] },
|
|
||||||
},
|
|
||||||
|
|
||||||
/* Test against mobile viewports. */
|
|
||||||
{
|
|
||||||
name: 'Mobile Chrome',
|
|
||||||
use: { ...devices['Pixel 5'] },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Mobile Safari',
|
|
||||||
use: { ...devices['iPhone 12'] },
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
/* Run your local dev server before starting the tests */
|
|
||||||
webServer: {
|
|
||||||
command: 'npm run dev',
|
|
||||||
url: 'http://127.0.0.1:5173',
|
|
||||||
reuseExistingServer: !process.env.CI,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
@ -11,9 +11,6 @@ app.get("/api", (req, res) => res.send("HI"))
|
||||||
// and your app is "just a request handler"
|
// and your app is "just a request handler"
|
||||||
app.all("*", createRequestHandler({ build }))
|
app.all("*", createRequestHandler({ build }))
|
||||||
|
|
||||||
import { register } from "register-service-worker";
|
|
||||||
|
|
||||||
register(`/service-worker.js`)
|
|
||||||
|
|
||||||
app.listen(3000, () => {
|
app.listen(3000, () => {
|
||||||
console.log("App listening on http://localhost:3000")
|
console.log("App listening on http://localhost:3000")
|
||||||
|
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
|
||||||
// allows you to do things like:
|
|
||||||
// expect(element).toHaveTextContent(/react/i)
|
|
||||||
// learn more: https://github.com/testing-library/jest-dom
|
|
||||||
import React from 'react'
|
|
||||||
import '@testing-library/jest-dom'
|
|
||||||
|
|
||||||
const JSDOMFormData = global.FormData;
|
|
||||||
global.React = React
|
|
||||||
global.TextDecoder = require("util").TextDecoder;
|
|
||||||
global.TextEncoder = require("util").TextEncoder;
|
|
||||||
global.ReadableStream = require("stream/web").ReadableStream;
|
|
||||||
global.WritableStream = require("stream/web").WritableStream;
|
|
||||||
|
|
||||||
require("@remix-run/node").installGlobals({ nativeFetch: true });
|
|
||||||
global.FormData = JSDOMFormData;
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
presets: [
|
|
||||||
[
|
|
||||||
"@babel/preset-env",
|
|
||||||
{
|
|
||||||
targets: {
|
|
||||||
node: "18",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"@babel/preset-react",
|
|
||||||
"@babel/preset-typescript",
|
|
||||||
],
|
|
||||||
plugins: [
|
|
||||||
"@babel/plugin-proposal-export-namespace-from",
|
|
||||||
"@babel/plugin-proposal-optional-chaining",
|
|
||||||
// Strip console.debug calls unless REMIX_DEBUG=true
|
|
||||||
...(process.env.REMIX_DEBUG === "true"
|
|
||||||
? []
|
|
||||||
: [
|
|
||||||
[
|
|
||||||
"transform-remove-console",
|
|
||||||
{ exclude: ["error", "warn", "log", "info"] },
|
|
||||||
],
|
|
||||||
]),
|
|
||||||
],
|
|
||||||
}
|
|
||||||
24
transform.js
24
transform.js
|
|
@ -1,24 +0,0 @@
|
||||||
import babelJest from "babel-jest"
|
|
||||||
|
|
||||||
import baseConfig from "./thebabel.config.cjs"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Replace `import.meta` with `undefined`
|
|
||||||
*
|
|
||||||
* Needed to support server-side CJS in Jest
|
|
||||||
* that access `@remix-run/react`, where `import.meta.hot`
|
|
||||||
* is used for HMR.
|
|
||||||
*/
|
|
||||||
let metaPlugin = ({ types: t }) => ({
|
|
||||||
visitor: {
|
|
||||||
MetaProperty: (path) => {
|
|
||||||
path.replaceWith(t.identifier("undefined"));
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default babelJest.createTransformer({
|
|
||||||
babelrc: false,
|
|
||||||
...baseConfig,
|
|
||||||
plugins: [...baseConfig.plugins, metaPlugin],
|
|
||||||
});
|
|
||||||
|
|
@ -1,19 +1,33 @@
|
||||||
{
|
{
|
||||||
"include": ["**/*.ts", "**/*.tsx"],
|
"include": [
|
||||||
"exclude": ["dist", "__tests__", "node_modules"],
|
"**/*.ts",
|
||||||
|
"**/*.tsx",
|
||||||
|
"**/.server/**/*.ts",
|
||||||
|
"**/.server/**/*.tsx",
|
||||||
|
"**/.client/**/*.ts",
|
||||||
|
"**/.client/**/*.tsx"
|
||||||
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
||||||
"target": "ES2022",
|
"types": ["@remix-run/node", "vite/client"],
|
||||||
"module": "ES2022",
|
"isolatedModules": true,
|
||||||
"skipLibCheck": true,
|
"esModuleInterop": true,
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
"module": "ESNext",
|
||||||
"moduleResolution": "Bundler",
|
"moduleResolution": "Bundler",
|
||||||
"allowSyntheticDefaultImports": true,
|
"resolveJsonModule": true,
|
||||||
|
"target": "ES2022",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"jsx": "react",
|
"allowJs": true,
|
||||||
"declaration": true,
|
"skipLibCheck": true,
|
||||||
"emitDeclarationOnly": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"rootDir": ".",
|
"baseUrl": ".",
|
||||||
"outDir": "../../build/node_modules/@remix-run/testing/dist"
|
"paths": {
|
||||||
|
"~/*": ["./app/*"]
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
// Vite takes care of building everything, not tsc.
|
||||||
|
"noEmit": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,10 @@
|
||||||
import { vitePlugin as remix } from "@remix-run/dev"
|
import { vitePlugin as remix } from "@remix-run/dev";
|
||||||
import { installGlobals } from "@remix-run/node"
|
import { installGlobals } from "@remix-run/node";
|
||||||
import { defineConfig } from "vite"
|
import { defineConfig } from "vite";
|
||||||
import tsconfigPaths from "vite-tsconfig-paths"
|
import tsconfigPaths from "vite-tsconfig-paths";
|
||||||
import { remixPWA } from '@remix-pwa/dev'
|
|
||||||
|
|
||||||
installGlobals()
|
installGlobals();
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [remix(), tsconfigPaths()],
|
||||||
remix(),
|
});
|
||||||
tsconfigPaths(),
|
|
||||||
remixPWA()
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue