Skip to content

Commit 5367f6c

Browse files
committed
Setup unit test environment
Installed packages `mocha`, `ts-node`& `tsconfig-paths` for the selected unit test framework. Configured `npm test` command to run the unit tests locate in `test/` folder.
1 parent 59b0a50 commit 5367f6c

File tree

4 files changed

+183
-5
lines changed

4 files changed

+183
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ electron-react-typescript-base-proj/
4747
| | | - renderer.tsx //- Entry point of 'electron-renderer'
4848
| | - utils/ //- Common utilities
4949
| | - declarations.d.ts
50+
| - test/ //- Unit tests
5051
| - .gitignore
5152
| - package-lock.json
5253
| - package.json

package-lock.json

Lines changed: 174 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "electron-react-typescript-base-proj",
33
"version": "1.1.0",
4-
"description":
5-
"Pre-configured base project for Electron + React + TypeScript + Redux",
4+
"description": "Pre-configured base project for Electron + React + TypeScript + Redux",
65
"main": "./dist/main.bundle.js",
76
"scripts": {
87
"start": "electron ./dist/main.bundle.js",
98
"dev": "rimraf dist && webpack --watch --config ./webpack.dev.js --progress --colors",
10-
"prod": "rimraf dist && webpack --config ./webpack.prod.js --progress --colors"
9+
"prod": "rimraf dist && webpack --config ./webpack.prod.js --progress --colors",
10+
"test": "mocha -r ts-node/register -r tsconfig-paths/register test/**/*.ts"
1111
},
1212
"author": "Wing Chau",
1313
"license": "MIT",
@@ -20,6 +20,7 @@
2020
"redux": "^4.0.1"
2121
},
2222
"devDependencies": {
23+
"@types/mocha": "^5.2.5",
2324
"@types/react-router": "^4.0.32",
2425
"@types/react-router-dom": "^4.3.1",
2526
"ajv": "^6.5.4",
@@ -28,9 +29,12 @@
2829
"electron": "^3.0.6",
2930
"file-loader": "^2.0.0",
3031
"html-webpack-plugin": "^3.2.0",
32+
"mocha": "^5.2.0",
3133
"rimraf": "^2.6.2",
3234
"source-map-loader": "^0.2.4",
3335
"ts-loader": "^5.2.2",
36+
"ts-node": "^7.0.1",
37+
"tsconfig-paths": "^3.6.0",
3438
"tslint": "^5.11.0",
3539
"tslint-microsoft-contrib": "^5.2.1",
3640
"typescript": "^3.1.3",

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"renderer*": ["src/renderer/"],
1414
"utils*": ["src/utils"]
1515
},
16-
"module": "ESNext",
16+
"module": "commonjs",
1717
"moduleResolution": "node",
1818
"noImplicitAny": true,
1919
"noImplicitThis": true,

0 commit comments

Comments
 (0)