You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-18Lines changed: 20 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,7 +68,7 @@ Add the following to your Jest config:
68
68
"^.+\\.svelte$": "svelte-jester"
69
69
},
70
70
"moduleFileExtensions": ["js", "svelte"],
71
-
"extensionsToTreatAsEsm": ["svelte"]
71
+
"extensionsToTreatAsEsm": [".svelte"]
72
72
}
73
73
```
74
74
@@ -136,7 +136,7 @@ export default config = {
136
136
};
137
137
```
138
138
139
-
To learn what options you can pass to `sveltePreprocess`, please refer to the [documentation](https://github.com/sveltejs/svelte-preprocess/blob/master/docs/preprocessing.md#typescript).
139
+
To learn what options you can pass to `sveltePreprocess`, please refer to the [documentation](https://github.com/sveltejs/svelte-preprocess/blob/main/docs/preprocessing.md#typescript).
140
140
141
141
1. In your Jest config, enable preprocessing for `svelte-jester`, and add `ts-jest` as a transform:
142
142
@@ -148,7 +148,14 @@ export default config = {
148
148
"preprocess": true
149
149
}
150
150
],
151
-
"^.+\\.ts$": "ts-jest"
151
+
"^.+\\.ts$": [
152
+
"ts-jest",
153
+
{
154
+
"useESM": true
155
+
// optional: seperate tsconfig for tests
156
+
//"tsconfig": "tsconfig.spec.json",
157
+
}
158
+
],
152
159
},
153
160
"moduleFileExtensions": [
154
161
"js",
@@ -159,12 +166,6 @@ export default config = {
159
166
".svelte",
160
167
".ts"
161
168
],
162
-
"globals": {
163
-
"ts-jest": {
164
-
"tsconfig": "tsconfig.spec.json",
165
-
"useESM": true
166
-
}
167
-
},
168
169
```
169
170
170
171
However if you do not want to create a `svelte.config.js` at the root of your
@@ -179,7 +180,14 @@ path to the config file to the `preprocess` option thus:
179
180
"preprocess": "/some/path/to/svelte.config.js"
180
181
}
181
182
],
182
-
"^.+\\.ts$": "ts-jest"
183
+
"^.+\\.ts$": [
184
+
"ts-jest",
185
+
{
186
+
"useESM": true
187
+
// optional: seperate tsconfig for tests
188
+
//"tsconfig": "tsconfig.spec.json",
189
+
}
190
+
],
183
191
},
184
192
"moduleFileExtensions": [
185
193
"js",
@@ -190,12 +198,6 @@ path to the config file to the `preprocess` option thus:
190
198
".svelte",
191
199
".ts"
192
200
],
193
-
"globals": {
194
-
"ts-jest": {
195
-
"tsconfig": "tsconfig.spec.json",
196
-
"useESM": true
197
-
}
198
-
},
199
201
```
200
202
201
203
#### CJS version
@@ -212,7 +214,7 @@ path to the config file to the `preprocess` option thus:
212
214
};
213
215
```
214
216
215
-
To learn what options you can pass to `sveltePreprocess`, please refer to the [documentation](https://github.com/sveltejs/svelte-preprocess/blob/master/docs/preprocessing.md#typescript).
217
+
To learn what options you can pass to `sveltePreprocess`, please refer to the [documentation](https://github.com/sveltejs/svelte-preprocess/blob/main/docs/preprocessing.md#typescript).
216
218
217
219
1. In your Jest config, enable preprocessing for `svelte-jester`, and add `ts-jest` as a transform:
218
220
@@ -343,6 +345,6 @@ Thanks to all contributors, inspired by:
0 commit comments