Skip to content

Commit a3e53c9

Browse files
docs: ts jest config migration (#142)
1 parent cd9f25e commit a3e53c9

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22
on:
33
push:
44
branches:
5-
- master
5+
- main
66
pull_request:
77
jobs:
88
Tests:

README.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Add the following to your Jest config:
6868
"^.+\\.svelte$": "svelte-jester"
6969
},
7070
"moduleFileExtensions": ["js", "svelte"],
71-
"extensionsToTreatAsEsm": ["svelte"]
71+
"extensionsToTreatAsEsm": [".svelte"]
7272
}
7373
```
7474

@@ -136,7 +136,7 @@ export default config = {
136136
};
137137
```
138138

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).
140140

141141
1. In your Jest config, enable preprocessing for `svelte-jester`, and add `ts-jest` as a transform:
142142

@@ -148,7 +148,14 @@ export default config = {
148148
"preprocess": true
149149
}
150150
],
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+
],
152159
},
153160
"moduleFileExtensions": [
154161
"js",
@@ -159,12 +166,6 @@ export default config = {
159166
".svelte",
160167
".ts"
161168
],
162-
"globals": {
163-
"ts-jest": {
164-
"tsconfig": "tsconfig.spec.json",
165-
"useESM": true
166-
}
167-
},
168169
```
169170

170171
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:
179180
"preprocess": "/some/path/to/svelte.config.js"
180181
}
181182
],
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+
],
183191
},
184192
"moduleFileExtensions": [
185193
"js",
@@ -190,12 +198,6 @@ path to the config file to the `preprocess` option thus:
190198
".svelte",
191199
".ts"
192200
],
193-
"globals": {
194-
"ts-jest": {
195-
"tsconfig": "tsconfig.spec.json",
196-
"useESM": true
197-
}
198-
},
199201
```
200202

201203
#### CJS version
@@ -212,7 +214,7 @@ path to the config file to the `preprocess` option thus:
212214
};
213215
```
214216

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).
216218

217219
1. In your Jest config, enable preprocessing for `svelte-jester`, and add `ts-jest` as a transform:
218220

@@ -343,6 +345,6 @@ Thanks to all contributors, inspired by:
343345
<!-- prettier-ignore-start -->
344346
[package]: https://www.npmjs.com/package/svelte-jester
345347
[version-badge]: https://img.shields.io/npm/v/svelte-jester
346-
[license]: https://github.com/svelteness/svelte-jester/blob/master/LICENSE
348+
[license]: https://github.com/svelteness/svelte-jester/blob/main/LICENSE
347349
[license-badge]: https://img.shields.io/github/license/svelteness/svelte-jester?color=b
348350
<!-- prettier-ignore-end -->

0 commit comments

Comments
 (0)