Skip to content

Commit 7bf06f4

Browse files
committed
[add] Test scripts & configuration based on Jest
1 parent cc4b376 commit 7bf06f4

File tree

8 files changed

+2261
-23
lines changed

8 files changed

+2261
-23
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ package-lock.json
33
yarn.lock
44
.parcel-cache/
55
dist/
6-
docs/
6+
docs/
7+
.vscode/settings.json

.npmignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.parcel-cache/
2+
test/
23
docs/
34
.husky/
4-
.github/
5+
.github/
6+
.vscode/

.vscode/launch.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Debug Jest",
6+
"type": "node",
7+
"request": "launch",
8+
"port": 9229,
9+
"runtimeArgs": [
10+
"--inspect-brk",
11+
"${workspaceRoot}/node_modules/jest/bin/jest.js",
12+
"--runInBand"
13+
],
14+
"console": "integratedTerminal",
15+
"internalConsoleOptions": "neverOpen"
16+
}
17+
]
18+
}

package.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dom-renderer",
3-
"version": "2.0.0-alpha.0",
3+
"version": "2.0.0-alpha.1",
44
"license": "LGPL-3.0-or-later",
55
"author": "[email protected]",
66
"description": "A light-weight DOM Renderer supports Web components standard & TypeScript language",
@@ -31,11 +31,16 @@
3131
"devDependencies": {
3232
"@parcel/packager-ts": "~2.8.3",
3333
"@parcel/transformer-typescript-types": "~2.8.3",
34+
"@types/jest": "^29.5.3",
35+
"@types/node": "^18.17.1",
3436
"husky": "^8.0.3",
37+
"jest": "^29.6.2",
38+
"jest-environment-jsdom": "^29.6.2",
3539
"lint-staged": "^13.2.3",
3640
"open-cli": "^7.2.0",
3741
"parcel": "~2.8.3",
3842
"prettier": "^3.0.0",
43+
"ts-jest": "^29.1.1",
3944
"typedoc": "^0.24.8",
4045
"typedoc-plugin-mdn-links": "^3.0.3",
4146
"typescript": "~5.1.6"
@@ -49,6 +54,10 @@
4954
"lint-staged": {
5055
"*.{md,json,yml,ts}": "prettier --write"
5156
},
57+
"jest": {
58+
"preset": "ts-jest",
59+
"testEnvironment": "jsdom"
60+
},
5261
"browserslist": "> 0.5%, last 2 versions, not dead, IE 11",
5362
"targets": {
5463
"main": {
@@ -57,7 +66,7 @@
5766
},
5867
"scripts": {
5968
"prepare": "husky install",
60-
"test": "lint-staged",
69+
"test": "lint-staged && jest",
6170
"build": "rm -rf dist/ docs/ && typedoc source/ && parcel build",
6271
"start": "typedoc source/ && open-cli docs/index.html",
6372
"prepublishOnly": "npm test && npm run build"

0 commit comments

Comments
 (0)