Skip to content

Commit

Permalink
fix(dapp): add jest config under dapp; remove dead tests
Browse files Browse the repository at this point in the history
  • Loading branch information
moconnell committed Jan 11, 2024
1 parent d8013d3 commit d3beab9
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 46 deletions.
31 changes: 31 additions & 0 deletions packages/dapp/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import type {Config} from 'jest';
import nextJest from 'next/jest.js'

const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './',
})

const esModules = ['isows'].join('|');

const config: Config = {
coverageProvider: 'v8',
preset: "ts-jest",
rootDir: ".",
setupFilesAfterEnv: ["<rootDir>/test/setupTests.ts"],
testEnvironment: 'jsdom',
testMatch: ["<rootDir>/test/**/*.test.(ts|tsx)"],
transform: {
[`(${esModules}).+\.js$`]: "babel-jest",
"^.+\.(ts|tsx)$": [
"ts-jest", {
tsconfig: "<rootDir>/tsconfig.test.json"
}
],
},
transformIgnorePatterns: [`/node_modules/(?!${esModules})`],
verbose: true,
}

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
export default createJestConfig(config);
3 changes: 2 additions & 1 deletion packages/dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"dev": "next dev",
"start": "next start",
"build": "next build",
"test": "next test",
"test": "jest",
"test:watch": "jest --watch",
"lint": "eslint \"**/*.{js,jsx,ts,tsx}\"",
"format": "prettier --ignore-path .prettierignore --write \"**/*.{js,jsx,ts,tsx}\""
},
Expand Down
13 changes: 0 additions & 13 deletions packages/dapp/test/components/NavButton.test.tsx

This file was deleted.

21 changes: 0 additions & 21 deletions packages/dapp/test/components/ProfileButton.test.tsx

This file was deleted.

11 changes: 0 additions & 11 deletions packages/dapp/test/components/StyledButton.test.tsx

This file was deleted.

1 change: 1 addition & 0 deletions packages/dapp/test/setupTests.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '@testing-library/jest-dom';
import { TextEncoder, TextDecoder } from 'util';

Object.assign(global, { TextDecoder, TextEncoder });

0 comments on commit d3beab9

Please # to comment.