Skip to content

Commit 52d00a4

Browse files
authored
Merge pull request #3445 from daiyam/refactor-better-mocha
refactor(test): enhance mocha usability
2 parents c71f947 + 37c4cae commit 52d00a4

File tree

5 files changed

+26
-3
lines changed

5 files changed

+26
-3
lines changed

.mocha.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NODE_PATH=./out

.mocharc.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require:
2+
- source-map-support/register
3+
spec:
4+
- out/**/*.test.js
5+
- addons/**/out/*.test.js
6+
watch-files:
7+
- out/**/*.js
8+
- addons/**/out/*.js
9+
reporter: spec
10+
color: true
11+
check-leaks: true

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"typescript.preferences.importModuleSpecifier": "non-relative",
3-
"typescript.preferences.quoteStyle": "single"
3+
"typescript.preferences.quoteStyle": "single",
4+
"mochaExplorer.envPath": ".mocha.env"
45
}

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"test-api-webkit": "node ./bin/test_api.js --browser=webkit --timeout=20000",
2424
"test-unit": "node ./bin/test.js",
2525
"test-unit-coverage": "node ./bin/test.js --coverage",
26+
"test-unit-dev": "cross-env NODE_PATH='./out' mocha",
2627
"build": "tsc -b ./tsconfig.all.json",
2728
"prepare": "npm run setup",
2829
"setup": "npm run build",
@@ -49,6 +50,7 @@
4950
"@typescript-eslint/eslint-plugin": "^4.23.0",
5051
"@typescript-eslint/parser": "^4.23.0",
5152
"chai": "^4.3.4",
53+
"cross-env": "^7.0.3",
5254
"deep-equal": "^2.0.5",
5355
"eslint": "^7.26.0",
5456
"express": "^4.17.1",
@@ -61,6 +63,7 @@
6163
"nyc": "^15.1.0",
6264
"playwright": "^1.11.0",
6365
"source-map-loader": "^2.0.1",
66+
"source-map-support": "^0.5.19",
6467
"ts-loader": "^9.1.2",
6568
"typescript": "^4.2.4",
6669
"utf8": "^3.0.0",

yarn.lock

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,14 @@ core-util-is@1.0.2, core-util-is@~1.0.0:
13291329
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
13301330
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
13311331

1332-
cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
1332+
cross-env@^7.0.3:
1333+
version "7.0.3"
1334+
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
1335+
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
1336+
dependencies:
1337+
cross-spawn "^7.0.1"
1338+
1339+
cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
13331340
version "7.0.3"
13341341
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
13351342
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
@@ -3909,7 +3916,7 @@ source-map-loader@^2.0.1:
39093916
iconv-lite "^0.6.2"
39103917
source-map-js "^0.6.2"
39113918

3912-
source-map-support@~0.5.19:
3919+
source-map-support@^0.5.19, source-map-support@~0.5.19:
39133920
version "0.5.19"
39143921
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
39153922
integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==

0 commit comments

Comments
 (0)