Skip to content

Commit fc3f026

Browse files
committed
Setup test environment with Jest
1 parent b39215e commit fc3f026

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

jestconfig.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"transform": {
3+
"^.+\\.tsx?$": "ts-jest"
4+
},
5+
"testRegex": "/tests/.*\\.test\\.(tsx?)$",
6+
"moduleFileExtensions": [
7+
"ts",
8+
"js",
9+
"tsx",
10+
"json",
11+
"node"
12+
],
13+
"testEnvironment": "jsdom"
14+
}

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,19 @@
5959
"rename": "bash -c 'for file in *.js; do mv $file \"${file%.js}.$0.js\"; done'",
6060
"build": "tsc --module commonjs && npm run rename -- cjs && tsc --declaration",
6161
"prebuild": "rm -r metadata stylesheet.json index* types* styles* || true",
62-
"postbuild": "cp resources/stylesheet.json stylesheet.json"
62+
"postbuild": "cp resources/stylesheet.json stylesheet.json",
63+
"test": "jest --config jestconfig.json"
6364
},
6465
"license": "MIT",
6566
"peerDependencies": {
6667
"react": ">=16"
6768
},
6869
"devDependencies": {
70+
"@types/jest": "^29.5.7",
6971
"@types/react": "^18.2.34",
72+
"jest": "^29.7.0",
73+
"jest-environment-jsdom": "^29.7.0",
74+
"ts-jest": "^29.1.1",
7075
"tslib": "^2.6.2",
7176
"tsx": "^3.12.10",
7277
"typescript": "^5.2.2"

0 commit comments

Comments
 (0)