Skip to content

Commit 37c134e

Browse files
committed
test: run tests in a temporary directory created by tempy
Tests are now run in a temporary directory created outside the project directory, and inside the Operating System's native temporary directory. This fixes several issues: * Tests would have failed if tests are run with a working directory outside the project directory. * Tests picked up prettier configuration of the project itself, which was potentially confusing. * Tests would have deleted any directory named "tmp" in the working directory even if that directory was not created by the tests themselves.
1 parent 1863dbf commit 37c134e

File tree

17 files changed

+468
-34
lines changed

17 files changed

+468
-34
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"rimraf": "5.0.10",
7575
"semantic-release": "23.1.1",
7676
"semantic-release-pinst": "1.0.4",
77+
"tempy": "1.0.1",
7778
"ts-jest": "29.1.4",
7879
"typescript": "5.4.5"
7980
},
@@ -91,8 +92,6 @@
9192
"extends": "@softwareventures/semantic-release-config"
9293
},
9394
"jest": {
94-
"globalSetup": "<rootDir>/test/global-setup.ts",
95-
"globalTeardown": "<rootDir>/test/global-teardown.ts",
9695
"watchPathIgnorePatterns": [
9796
"<rootDir>/tmp"
9897
],
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 4,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": false,
7+
"quoteProps": "consistent",
8+
"jsxSingleQuote": false,
9+
"trailingComma": "none",
10+
"bracketSpacing": false,
11+
"bracketSameLine": false,
12+
"arrowParens": "avoid",
13+
"requirePragma": false,
14+
"insertPragma": false,
15+
"proseWrap": "always",
16+
"htmlWhitespaceSensitivity": "css",
17+
"vueIndentScriptAndStyle": true,
18+
"endOfLine": "auto",
19+
"overrides": [
20+
{
21+
"files": [
22+
"*.css",
23+
"*.htm",
24+
"*.html",
25+
"*.json",
26+
"*.less",
27+
"*.sass",
28+
"*.yaml",
29+
"*.yml",
30+
"*.xml"
31+
],
32+
"options": {
33+
"tabWidth": 2
34+
}
35+
},
36+
{
37+
"files": [
38+
"*.md"
39+
],
40+
"options": {
41+
"printWidth": 80
42+
}
43+
}
44+
]
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 4,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": false,
7+
"quoteProps": "consistent",
8+
"jsxSingleQuote": false,
9+
"trailingComma": "none",
10+
"bracketSpacing": false,
11+
"bracketSameLine": false,
12+
"arrowParens": "avoid",
13+
"requirePragma": false,
14+
"insertPragma": false,
15+
"proseWrap": "always",
16+
"htmlWhitespaceSensitivity": "css",
17+
"vueIndentScriptAndStyle": true,
18+
"endOfLine": "auto",
19+
"overrides": [
20+
{
21+
"files": [
22+
"*.css",
23+
"*.htm",
24+
"*.html",
25+
"*.json",
26+
"*.less",
27+
"*.sass",
28+
"*.yaml",
29+
"*.yml",
30+
"*.xml"
31+
],
32+
"options": {
33+
"tabWidth": 2
34+
}
35+
},
36+
{
37+
"files": [
38+
"*.md"
39+
],
40+
"options": {
41+
"printWidth": 80
42+
}
43+
}
44+
]
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 4,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": false,
7+
"quoteProps": "consistent",
8+
"jsxSingleQuote": false,
9+
"trailingComma": "none",
10+
"bracketSpacing": false,
11+
"bracketSameLine": false,
12+
"arrowParens": "avoid",
13+
"requirePragma": false,
14+
"insertPragma": false,
15+
"proseWrap": "always",
16+
"htmlWhitespaceSensitivity": "css",
17+
"vueIndentScriptAndStyle": true,
18+
"endOfLine": "auto",
19+
"overrides": [
20+
{
21+
"files": [
22+
"*.css",
23+
"*.htm",
24+
"*.html",
25+
"*.json",
26+
"*.less",
27+
"*.sass",
28+
"*.yaml",
29+
"*.yml",
30+
"*.xml"
31+
],
32+
"options": {
33+
"tabWidth": 2
34+
}
35+
},
36+
{
37+
"files": [
38+
"*.md"
39+
],
40+
"options": {
41+
"printWidth": 80
42+
}
43+
}
44+
]
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 4,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": false,
7+
"quoteProps": "consistent",
8+
"jsxSingleQuote": false,
9+
"trailingComma": "none",
10+
"bracketSpacing": false,
11+
"bracketSameLine": false,
12+
"arrowParens": "avoid",
13+
"requirePragma": false,
14+
"insertPragma": false,
15+
"proseWrap": "always",
16+
"htmlWhitespaceSensitivity": "css",
17+
"vueIndentScriptAndStyle": true,
18+
"endOfLine": "auto",
19+
"overrides": [
20+
{
21+
"files": [
22+
"*.css",
23+
"*.htm",
24+
"*.html",
25+
"*.json",
26+
"*.less",
27+
"*.sass",
28+
"*.yaml",
29+
"*.yml",
30+
"*.xml"
31+
],
32+
"options": {
33+
"tabWidth": 2
34+
}
35+
},
36+
{
37+
"files": [
38+
"*.md"
39+
],
40+
"options": {
41+
"printWidth": 80
42+
}
43+
}
44+
]
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 4,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": false,
7+
"quoteProps": "consistent",
8+
"jsxSingleQuote": false,
9+
"trailingComma": "none",
10+
"bracketSpacing": false,
11+
"bracketSameLine": false,
12+
"arrowParens": "avoid",
13+
"requirePragma": false,
14+
"insertPragma": false,
15+
"proseWrap": "always",
16+
"htmlWhitespaceSensitivity": "css",
17+
"vueIndentScriptAndStyle": true,
18+
"endOfLine": "auto",
19+
"overrides": [
20+
{
21+
"files": [
22+
"*.css",
23+
"*.htm",
24+
"*.html",
25+
"*.json",
26+
"*.less",
27+
"*.sass",
28+
"*.yaml",
29+
"*.yml",
30+
"*.xml"
31+
],
32+
"options": {
33+
"tabWidth": 2
34+
}
35+
},
36+
{
37+
"files": [
38+
"*.md"
39+
],
40+
"options": {
41+
"printWidth": 80
42+
}
43+
}
44+
]
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 4,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": false,
7+
"quoteProps": "consistent",
8+
"jsxSingleQuote": false,
9+
"trailingComma": "none",
10+
"bracketSpacing": false,
11+
"bracketSameLine": false,
12+
"arrowParens": "avoid",
13+
"requirePragma": false,
14+
"insertPragma": false,
15+
"proseWrap": "always",
16+
"htmlWhitespaceSensitivity": "css",
17+
"vueIndentScriptAndStyle": true,
18+
"endOfLine": "auto",
19+
"overrides": [
20+
{
21+
"files": [
22+
"*.css",
23+
"*.htm",
24+
"*.html",
25+
"*.json",
26+
"*.less",
27+
"*.sass",
28+
"*.yaml",
29+
"*.yml",
30+
"*.xml"
31+
],
32+
"options": {
33+
"tabWidth": 2
34+
}
35+
},
36+
{
37+
"files": [
38+
"*.md"
39+
],
40+
"options": {
41+
"printWidth": 80
42+
}
43+
}
44+
]
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 4,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": false,
7+
"quoteProps": "consistent",
8+
"jsxSingleQuote": false,
9+
"trailingComma": "none",
10+
"bracketSpacing": false,
11+
"bracketSameLine": false,
12+
"arrowParens": "avoid",
13+
"requirePragma": false,
14+
"insertPragma": false,
15+
"proseWrap": "always",
16+
"htmlWhitespaceSensitivity": "css",
17+
"vueIndentScriptAndStyle": true,
18+
"endOfLine": "auto",
19+
"overrides": [
20+
{
21+
"files": [
22+
"*.css",
23+
"*.htm",
24+
"*.html",
25+
"*.json",
26+
"*.less",
27+
"*.sass",
28+
"*.yaml",
29+
"*.yml",
30+
"*.xml"
31+
],
32+
"options": {
33+
"tabWidth": 2
34+
}
35+
},
36+
{
37+
"files": [
38+
"*.md"
39+
],
40+
"options": {
41+
"printWidth": 80
42+
}
43+
}
44+
]
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 4,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": false,
7+
"quoteProps": "consistent",
8+
"jsxSingleQuote": false,
9+
"trailingComma": "none",
10+
"bracketSpacing": false,
11+
"bracketSameLine": false,
12+
"arrowParens": "avoid",
13+
"requirePragma": false,
14+
"insertPragma": false,
15+
"proseWrap": "always",
16+
"htmlWhitespaceSensitivity": "css",
17+
"vueIndentScriptAndStyle": true,
18+
"endOfLine": "auto",
19+
"overrides": [
20+
{
21+
"files": [
22+
"*.css",
23+
"*.htm",
24+
"*.html",
25+
"*.json",
26+
"*.less",
27+
"*.sass",
28+
"*.yaml",
29+
"*.yml",
30+
"*.xml"
31+
],
32+
"options": {
33+
"tabWidth": 2
34+
}
35+
},
36+
{
37+
"files": [
38+
"*.md"
39+
],
40+
"options": {
41+
"printWidth": 80
42+
}
43+
}
44+
]
45+
}

0 commit comments

Comments
 (0)