Skip to content

Commit

Permalink
some test stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
edspencer committed Aug 20, 2024
1 parent 4c288de commit c382904
Show file tree
Hide file tree
Showing 8 changed files with 2,855 additions and 134 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Run Jest Tests

on:
push: # Runs on all pushes
pull_request: # Runs on all pull requests

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x, 20.x, 22.x]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"

- name: Install dependencies
run: npm install

- name: Run tests
run: npm test
19 changes: 19 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// jest.config.ts
import type { JestConfigWithTsJest } from "ts-jest";

const jestConfig: JestConfigWithTsJest = {
preset: "ts-jest",
testEnvironment: "jsdom",
transform: {
// "^.+\\.(t|j)sx?$": ["@swc/jest"],
},
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/$1",
"\\.(css|less|sass|scss)$": "identity-obj-proxy",
},
modulePaths: ["<rootDir>"],
transformIgnorePatterns: ["/node_modules/(?!react18-json-view)"],
testPathIgnorePatterns: ["/node_modules/", "/dist/"],
};

export default jestConfig;
15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"example": "example"
},
"scripts": {
"test": "npx jest",
"build": "tsc && rollup -c",
"build:watch": "concurrently \"tsc --watch\" \"rollup -c --watch\"",
"ci:version": "changeset version",
Expand All @@ -27,27 +28,37 @@
"license": "ISC",
"devDependencies": {
"@changesets/cli": "^2.27.7",
"@jest/globals": "^29.7.0",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/react": "npm:types-react@rc",
"@types/react-dom": "npm:types-react-dom@rc",
"@testing-library/jest-dom": "^6.4.8",
"@types/jest": "^29.5.12",
"@types/react": "npm:[email protected]",
"@types/react-dom": "npm:[email protected]",
"@types/uuid": "^10.0.0",
"autoprefixer": "^10.4.20",
"concurrently": "^8.2.2",
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^4.6.2",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"postcss": "^8.4.41",
"rollup": "^4.20.0",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-typescript2": "^0.36.0",
"tailwindcss": "^3.4.9",
"ts-jest": "^29.2.4",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
},
"dependencies": {
"@ai-sdk/openai": "^0.0.44",
"@testing-library/dom": "^10.4.0",
"@testing-library/react": "^16.0.0",
"ai": "^3.3.6",
"clsx": "^2.1.1",
"nanoid": "^5.0.7",
"react": "19.0.0-rc-cc1ec60d0d-20240607",
"react-dom": "19.0.0-rc-cc1ec60d0d-20240607",
"react18-json-view": "^0.2.8",
Expand Down
Loading

0 comments on commit c382904

Please sign in to comment.