Tests work, for some reason
This commit is contained in:
parent
b46d1748ba
commit
56aaae38c1
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"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
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ import { act, render, screen, waitFor } from '@testing-library/react'
|
|||
|
||||
import { createRemixStub, RemixStubProps } from "@remix-run/testing"
|
||||
import App from './root'
|
||||
import React from 'react'
|
||||
let RemixStub: (props: RemixStubProps) => React.JSX.Element
|
||||
|
||||
describe("root", () => {
|
||||
|
|
@ -20,9 +21,9 @@ describe("root", () => {
|
|||
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/>)
|
||||
render(<RemixStub/>)
|
||||
let x: number = 4
|
||||
// await waitFor(() => screen.findByText<HTMLElement>("Whoah"))
|
||||
await waitFor(() => screen.findByText<HTMLElement>("Whoah"), { timeout: 2000 })
|
||||
console.log("YES HI")
|
||||
|
||||
expect(true).toBe(true)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import {
|
|||
Scripts,
|
||||
ScrollRestoration,
|
||||
} from "@remix-run/react";
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import React from "react";
|
||||
|
||||
export function Layout({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
|
|
@ -18,6 +18,7 @@ export function Layout({ children }: { children: React.ReactNode }) {
|
|||
</head>
|
||||
<body>
|
||||
{children}
|
||||
<div>Whoah</div>
|
||||
<ScrollRestoration />
|
||||
<Scripts />
|
||||
</body>
|
||||
|
|
@ -26,7 +27,6 @@ export function Layout({ children }: { children: React.ReactNode }) {
|
|||
}
|
||||
|
||||
export default function App() {
|
||||
return <Outlet />;
|
||||
return <div>Whoah</div>
|
||||
}
|
||||
|
||||
() => Promise<Json<{ contacts: Contact[]}>>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
module.exports = {
|
||||
presets: [
|
||||
['@babel/preset-env', { targets: { node: 'current' } }],
|
||||
'@babel/preset-typescript',
|
||||
["@babel/preset-react", {
|
||||
"runtime": "automatic"
|
||||
}]
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
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"] },
|
||||
],
|
||||
]),
|
||||
],
|
||||
};
|
||||
|
|
@ -1,19 +1,49 @@
|
|||
import type {Config} from 'jest';
|
||||
// import type {Config} from 'jest';
|
||||
|
||||
const config: Config = {
|
||||
verbose: true,
|
||||
testPathIgnorePatterns: ["/node_modules/", "data/"],
|
||||
watchPathIgnorePatterns: [
|
||||
"data"
|
||||
],
|
||||
preset: "ts-jest",
|
||||
testEnvironment: "jest-environment-jsdom",
|
||||
// const config: Config = {
|
||||
// verbose: true,
|
||||
// // testPathIgnorePatterns: [ "data/"],
|
||||
// watchPathIgnorePatterns: [
|
||||
// "data"
|
||||
// ],
|
||||
// preset: 'ts-jest',
|
||||
// testEnvironment: 'jest-environment-jsdom',
|
||||
// transform: {
|
||||
// "^.+\\.tsx?$": "ts-jest"
|
||||
// // process `*.tsx` files with `ts-jest`
|
||||
// },
|
||||
// resetMocks: true,
|
||||
// };
|
||||
|
||||
// export default config;
|
||||
|
||||
const ignorePatterns = [
|
||||
"\\/build\\/",
|
||||
"\\/coverage\\/",
|
||||
"\\/\\.vscode\\/",
|
||||
"\\/\\.tmp\\/",
|
||||
"\\/\\.cache\\/",
|
||||
"data"
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
moduleNameMapper: {
|
||||
"^@web3-storage/multipart-parser$": require.resolve(
|
||||
"@web3-storage/multipart-parser"
|
||||
),
|
||||
},
|
||||
modulePathIgnorePatterns: ignorePatterns,
|
||||
transform: {
|
||||
// '^.+\\.ts?$': 'ts-jest',
|
||||
// '^.+\\.tsx?$': 'ts-jest',
|
||||
'^.+\\.[t|j]s?$': 'babel-jest',
|
||||
'^.+\\.[t|j]sx?$': 'babel-jest',
|
||||
}
|
||||
};
|
||||
|
||||
export default config;
|
||||
"\\.[jt]sx?$": require.resolve("./transform"),
|
||||
},
|
||||
watchPathIgnorePatterns: [...ignorePatterns, "\\/node_modules\\/"],
|
||||
watchPlugins: [
|
||||
// require.resolve("jest-watch-select-projects"),
|
||||
// require.resolve("jest-watch-typeahead/filename"),
|
||||
// require.resolve("jest-watch-typeahead/testname"),
|
||||
],
|
||||
displayName: "testing",
|
||||
setupFiles: [],
|
||||
testEnvironment: "jsdom",
|
||||
setupFilesAfterEnv: ["./setupTests.ts", "@testing-library/jest-dom"],
|
||||
};
|
||||
|
|
@ -18,11 +18,15 @@
|
|||
},
|
||||
"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",
|
||||
"@remix-run/dev": "^2.9.0",
|
||||
"@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",
|
||||
"@types/express": "^4.17.21",
|
||||
|
|
@ -33,6 +37,7 @@
|
|||
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
||||
"@typescript-eslint/parser": "^6.7.4",
|
||||
"babel-jest": "^29.7.0",
|
||||
"babel-plugin-transform-remove-console": "^6.9.4",
|
||||
"chai": "^4.4.1",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"eslint": "^8.38.0",
|
||||
|
|
@ -680,6 +685,41 @@
|
|||
"@babel/core": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-proposal-export-namespace-from": {
|
||||
"version": "7.18.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.18.9.tgz",
|
||||
"integrity": "sha512-k1NtHyOMvlDDFeb9G5PhUXuGj8m/wiwojgQVEhJ/fsVsMCpLyOP4h0uGEjYJKrRI+EVPlb5Jk+Gt9P97lOGwtA==",
|
||||
"deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-export-namespace-from instead.",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.18.9",
|
||||
"@babel/plugin-syntax-export-namespace-from": "^7.8.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-proposal-optional-chaining": {
|
||||
"version": "7.21.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.21.0.tgz",
|
||||
"integrity": "sha512-p4zeefM72gpmEe2fkUr/OnOXpWEf8nAgk7ZYVqqfFiyIG7oFfVZcCrU64hWn5xp4tQ9LkV4bTIa5rD0KANpKNA==",
|
||||
"deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "^7.20.2",
|
||||
"@babel/helper-skip-transparent-expression-wrappers": "^7.20.0",
|
||||
"@babel/plugin-syntax-optional-chaining": "^7.8.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-proposal-private-property-in-object": {
|
||||
"version": "7.21.0-placeholder-for-preset-env.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz",
|
||||
|
|
@ -2860,6 +2900,18 @@
|
|||
"integrity": "sha512-wRiUsea88TjKDc4FBEn+sLvIDesp6brMbGWnJGjew2waAc9evdhja/2LvePc898HJbHw0L+MTWy7NhpnELAvLQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@jest/create-cache-key-function": {
|
||||
"version": "29.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@jest/create-cache-key-function/-/create-cache-key-function-29.7.0.tgz",
|
||||
"integrity": "sha512-4QqS3LY5PBmTRHj9sAg1HLoPzqAI0uOX6wI/TRqHIcOxlFidy6YEmCQJk6FSZjNLGCeubDMfmkWL+qaLKhSGQA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jest/types": "^29.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jest/environment": {
|
||||
"version": "29.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz",
|
||||
|
|
@ -4006,6 +4058,236 @@
|
|||
"integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@swc/core": {
|
||||
"version": "1.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core/-/core-1.5.7.tgz",
|
||||
"integrity": "sha512-U4qJRBefIJNJDRCCiVtkfa/hpiZ7w0R6kASea+/KLp+vkus3zcLSB8Ub8SvKgTIxjWpwsKcZlPf5nrv4ls46SQ==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@swc/counter": "^0.1.2",
|
||||
"@swc/types": "0.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/swc"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@swc/core-darwin-arm64": "1.5.7",
|
||||
"@swc/core-darwin-x64": "1.5.7",
|
||||
"@swc/core-linux-arm-gnueabihf": "1.5.7",
|
||||
"@swc/core-linux-arm64-gnu": "1.5.7",
|
||||
"@swc/core-linux-arm64-musl": "1.5.7",
|
||||
"@swc/core-linux-x64-gnu": "1.5.7",
|
||||
"@swc/core-linux-x64-musl": "1.5.7",
|
||||
"@swc/core-win32-arm64-msvc": "1.5.7",
|
||||
"@swc/core-win32-ia32-msvc": "1.5.7",
|
||||
"@swc/core-win32-x64-msvc": "1.5.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@swc/helpers": "^0.5.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@swc/helpers": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-darwin-arm64": {
|
||||
"version": "1.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.5.7.tgz",
|
||||
"integrity": "sha512-bZLVHPTpH3h6yhwVl395k0Mtx8v6CGhq5r4KQdAoPbADU974Mauz1b6ViHAJ74O0IVE5vyy7tD3OpkQxL/vMDQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-darwin-x64": {
|
||||
"version": "1.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.5.7.tgz",
|
||||
"integrity": "sha512-RpUyu2GsviwTc2qVajPL0l8nf2vKj5wzO3WkLSHAHEJbiUZk83NJrZd1RVbEknIMO7+Uyjh54hEh8R26jSByaw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-arm-gnueabihf": {
|
||||
"version": "1.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.5.7.tgz",
|
||||
"integrity": "sha512-cTZWTnCXLABOuvWiv6nQQM0hP6ZWEkzdgDvztgHI/+u/MvtzJBN5lBQ2lue/9sSFYLMqzqff5EHKlFtrJCA9dQ==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-arm64-gnu": {
|
||||
"version": "1.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.5.7.tgz",
|
||||
"integrity": "sha512-hoeTJFBiE/IJP30Be7djWF8Q5KVgkbDtjySmvYLg9P94bHg9TJPSQoC72tXx/oXOgXvElDe/GMybru0UxhKx4g==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-arm64-musl": {
|
||||
"version": "1.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.5.7.tgz",
|
||||
"integrity": "sha512-+NDhK+IFTiVK1/o7EXdCeF2hEzCiaRSrb9zD7X2Z7inwWlxAntcSuzZW7Y6BRqGQH89KA91qYgwbnjgTQ22PiQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-x64-gnu": {
|
||||
"version": "1.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.5.7.tgz",
|
||||
"integrity": "sha512-25GXpJmeFxKB+7pbY7YQLhWWjkYlR+kHz5I3j9WRl3Lp4v4UD67OGXwPe+DIcHqcouA1fhLhsgHJWtsaNOMBNg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-x64-musl": {
|
||||
"version": "1.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.5.7.tgz",
|
||||
"integrity": "sha512-0VN9Y5EAPBESmSPPsCJzplZHV26akC0sIgd3Hc/7S/1GkSMoeuVL+V9vt+F/cCuzr4VidzSkqftdP3qEIsXSpg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-win32-arm64-msvc": {
|
||||
"version": "1.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.5.7.tgz",
|
||||
"integrity": "sha512-RtoNnstBwy5VloNCvmvYNApkTmuCe4sNcoYWpmY7C1+bPR+6SOo8im1G6/FpNem8AR5fcZCmXHWQ+EUmRWJyuA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-win32-ia32-msvc": {
|
||||
"version": "1.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.5.7.tgz",
|
||||
"integrity": "sha512-Xm0TfvcmmspvQg1s4+USL3x8D+YPAfX2JHygvxAnCJ0EHun8cm2zvfNBcsTlnwYb0ybFWXXY129aq1wgFC9TpQ==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-win32-x64-msvc": {
|
||||
"version": "1.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.5.7.tgz",
|
||||
"integrity": "sha512-tp43WfJLCsKLQKBmjmY/0vv1slVywR5Q4qKjF5OIY8QijaEW7/8VwPyUyVoJZEnDgv9jKtUTG5PzqtIYPZGnyg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/counter": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz",
|
||||
"integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@swc/jest": {
|
||||
"version": "0.2.36",
|
||||
"resolved": "https://registry.npmjs.org/@swc/jest/-/jest-0.2.36.tgz",
|
||||
"integrity": "sha512-8X80dp81ugxs4a11z1ka43FPhP+/e+mJNXJSxiNYk8gIX/jPBtY4gQTrKu/KIoco8bzKuPI5lUxjfLiGsfvnlw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jest/create-cache-key-function": "^29.7.0",
|
||||
"@swc/counter": "^0.1.3",
|
||||
"jsonc-parser": "^3.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"npm": ">= 7.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@swc/core": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/types": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.7.tgz",
|
||||
"integrity": "sha512-scHWahbHF0eyj3JsxG9CFJgFdFNaVQCNAimBlT6PzS3n/HptxqREjsm4OH6AN3lYcffZYSPxXW8ua2BEHp0lJQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@swc/counter": "^0.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@testing-library/dom": {
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.0.0.tgz",
|
||||
|
|
@ -5385,6 +5667,12 @@
|
|||
"@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/babel-plugin-transform-remove-console": {
|
||||
"version": "6.9.4",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-console/-/babel-plugin-transform-remove-console-6.9.4.tgz",
|
||||
"integrity": "sha512-88blrUrMX3SPiGkT1GnvVY8E/7A+k6oj3MNvUtTIxJflFzXTw1bHkuJ/y039ouhFMp2prRn5cQGzokViYi1dsg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/babel-preset-current-node-syntax": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz",
|
||||
|
|
@ -10611,6 +10899,12 @@
|
|||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/jsonc-parser": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz",
|
||||
"integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/jsonfile": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
|
||||
|
|
|
|||
|
|
@ -2,14 +2,13 @@
|
|||
"name": "site",
|
||||
"private": true,
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "remix vite:build",
|
||||
"dev": "remix vite:dev",
|
||||
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
|
||||
"start": "remix-serve ./build/server/index.js",
|
||||
"typecheck": "tsc",
|
||||
"test": "jest --watch --config=jest.config.ts"
|
||||
"test": "jest --watch --config=jest.config.ts "
|
||||
},
|
||||
"dependencies": {
|
||||
"@remix-run/express": "^2.9.1",
|
||||
|
|
@ -27,8 +26,13 @@
|
|||
"@babel/preset-env": "^7.24.5",
|
||||
"@babel/preset-react": "^7.24.1",
|
||||
"@babel/preset-typescript": "^7.24.1",
|
||||
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
|
||||
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
|
||||
"babel-plugin-transform-remove-console": "^6.9.4",
|
||||
"@remix-run/dev": "^2.9.0",
|
||||
"@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",
|
||||
"@types/express": "^4.17.21",
|
||||
|
|
|
|||
|
|
@ -2,5 +2,15 @@
|
|||
// allows you to do things like:
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import 'react'
|
||||
import '@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;
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
let { default: babelJest } = require("babel-jest");
|
||||
|
||||
let baseConfig = require("./babel.config.js");
|
||||
|
||||
/**
|
||||
* 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"));
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = babelJest.createTransformer({
|
||||
babelrc: false,
|
||||
...baseConfig,
|
||||
plugins: [...baseConfig.plugins, metaPlugin],
|
||||
});
|
||||
|
|
@ -1,33 +1,53 @@
|
|||
{
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
"**/.server/**/*.ts",
|
||||
"**/.server/**/*.tsx",
|
||||
"**/.client/**/*.ts",
|
||||
"**/.client/**/*.tsx"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
||||
"types": ["@remix-run/jsdom", "@remix-run/node", "vite/client", "jest", "node"],
|
||||
"isolatedModules": true,
|
||||
"esModuleInterop": true,
|
||||
"jsx": "react-jsx",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"resolveJsonModule": true,
|
||||
"target": "ES2022",
|
||||
"strict": true,
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"~/*": ["./app/*"]
|
||||
},
|
||||
// {
|
||||
// "include": [
|
||||
// "**/*.ts",
|
||||
// "**/*.tsx",
|
||||
// "**/.server/**/*.ts",
|
||||
// "**/.server/**/*.tsx",
|
||||
// "**/.client/**/*.ts",
|
||||
// "**/.client/**/*.tsx"
|
||||
// ],
|
||||
// "exclude": ["node_modules"],
|
||||
// "compilerOptions": {
|
||||
// "lib": ["DOM", "DOM.Iterable", "ES2022"],
|
||||
// "types": ["@remix-run/jsdom", "@remix-run/node", "@remix-run/test", "vite/client", "jest", "node"],
|
||||
// "isolatedModules": true,
|
||||
// "esModuleInterop": true,
|
||||
// "jsx": "react-jsx",
|
||||
// "moduleResolution": "Bundler",
|
||||
// "resolveJsonModule": true,
|
||||
// "target": "ES2022",
|
||||
// "module": "ES2022",
|
||||
// "strict": true,
|
||||
// "allowJs": true,
|
||||
// "skipLibCheck": true,
|
||||
// "forceConsistentCasingInFileNames": true,
|
||||
// "baseUrl": ".",
|
||||
// "paths": {
|
||||
// "~/*": ["./app/*"]
|
||||
// },
|
||||
|
||||
|
||||
// Vite takes care of building everything, not tsc.
|
||||
"noEmit": true
|
||||
// // Vite takes care of building everything, not tsc.
|
||||
// "noEmit": true
|
||||
// }
|
||||
// }
|
||||
{
|
||||
"include": ["**/*.ts", "**/*.tsx"],
|
||||
"exclude": ["dist", "__tests__", "node_modules"],
|
||||
"compilerOptions": {
|
||||
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"skipLibCheck": true,
|
||||
|
||||
"moduleResolution": "Bundler",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"jsx": "react",
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"rootDir": ".",
|
||||
"outDir": "../../build/node_modules/@remix-run/testing/dist"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue