Skip to content

Commit 19ebcf2

Browse files
committedDec 19, 2021
build: updated build workflow to be able to write unit tests
1 parent efb486f commit 19ebcf2

File tree

5 files changed

+1967
-28
lines changed

5 files changed

+1967
-28
lines changed
 

‎.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ package-lock.json
88
# test specific
99
test-vault
1010

11+
# coverage report
12+
coverage
13+
1114
# docs
1215
docs/public

‎jest.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2+
module.exports = {
3+
preset: 'ts-jest',
4+
testEnvironment: 'node',
5+
modulePathIgnorePatterns: ["<rootDir>/docs/"],
6+
7+
modulePaths: ['<rootDir>', 'node_modules'],
8+
moduleDirectories: ['src', 'node_modules'],
9+
10+
};

‎package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"main": "src/main.ts",
66
"scripts": {
77
"dev": "node esbuild.config.mjs",
8-
"build": "node esbuild.config.mjs production"
8+
"build": "node esbuild.config.mjs production",
9+
"test": "jest",
10+
"coverage": "jest --coverage"
911
},
1012
"repository": "git@github.com:MSzturc/obsidian-advanced-slides.git",
1113
"author": "Matthäus Szturc",
@@ -14,6 +16,7 @@
1416
"@types/express": "4.11.1",
1517
"@types/fs-extra": "^9.0.13",
1618
"@types/glob": "^7.2.0",
19+
"@types/jest": "^27.0.3",
1720
"@types/lodash": "^4.14.177",
1821
"@types/mustache": "^4.1.2",
1922
"@types/node": "^16.11.11",
@@ -27,11 +30,13 @@
2730
"esbuild-plugin-copy": "^0.3.0",
2831
"esbuild-sass-plugin": "^1.8.0",
2932
"highlight.js": "^11.3.1",
33+
"jest": "^27.4.5",
3034
"node-sass": "^7.0.0",
3135
"obsidian": "^0.12.17",
3236
"reveal.js": "^4.2.1",
3337
"reveal.js-mermaid-plugin": "^0.0.2",
3438
"sass": "^1.45.0",
39+
"ts-mockito": "^2.6.1",
3540
"ts-node": "^10.4.0",
3641
"tslib": "^2.3.1",
3742
"typescript": "^4.5.2"

‎test/__mocks__/obsidian.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};

‎yarn.lock

+1,947-27
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.