Skip to content

Commit 9194f65

Browse files
committed
test: switch to vitest
1 parent a10ee6f commit 9194f65

29 files changed

+1288
-2778
lines changed

jest.config.js

-13
This file was deleted.

jest.setup.js

-1
This file was deleted.

package.json

+5-9
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,26 @@
1717
"prepublishOnly": "npx yarn build",
1818
"prettier:check": "prettier --list-different \"src/**/*.{ts,tsx}\"",
1919
"prettier:write": "prettier --write \"src/**/*.{ts,tsx}\"",
20-
"test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest",
20+
"test": "vitest run",
2121
"prepare": "husky"
2222
},
2323
"bin": {
2424
"electron-docs-linter": "./dist/bin.js",
2525
"electron-docs-parser": "./dist/bin.js"
2626
},
2727
"files": [
28-
"dist",
29-
"!dist/__tests__"
28+
"dist"
3029
],
3130
"devDependencies": {
3231
"@types/chai": "^4.3.19",
33-
"@types/jest": "^29.5.13",
3432
"@types/lodash.camelcase": "^4.3.9",
3533
"@types/node": "^22.5.5",
3634
"@types/pretty-ms": "^5.0.1",
37-
"cross-env": "^7.0.3",
3835
"husky": "^9.1.6",
39-
"jest": "^30.0.0-alpha.6",
4036
"lint-staged": "^15.2.10",
4137
"prettier": "^3.3.3",
42-
"ts-jest": "^29.2.5",
43-
"typescript": "^5.6.2"
38+
"typescript": "^5.6.2",
39+
"vitest": "^3.0.4"
4440
},
4541
"dependencies": {
4642
"@types/markdown-it": "^14.1.2",
@@ -71,4 +67,4 @@
7167
"url": "https://github.com/electron/docs-parser/issues"
7268
},
7369
"homepage": "https://github.com/electron/docs-parser#readme"
74-
}
70+
}

src/__tests__/__snapshots__/markdown-helpers.spec.ts.snap tests/__snapshots__/markdown-helpers.spec.ts.snap

+26-26
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`markdown-helpers rawTypeToTypeInformation() should allow commas in object types 1`] = `
3+
exports[`markdown-helpers > rawTypeToTypeInformation() > should allow commas in object types 1`] = `
44
{
55
"collection": false,
66
"parameters": [],
@@ -12,7 +12,7 @@ exports[`markdown-helpers rawTypeToTypeInformation() should allow commas in obje
1212
}
1313
`;
1414

15-
exports[`markdown-helpers rawTypeToTypeInformation() should map a Promise types correctly 1`] = `
15+
exports[`markdown-helpers > rawTypeToTypeInformation() > should map a Promise types correctly 1`] = `
1616
{
1717
"collection": false,
1818
"innerTypes": [
@@ -25,7 +25,7 @@ exports[`markdown-helpers rawTypeToTypeInformation() should map a Promise types
2525
}
2626
`;
2727

28-
exports[`markdown-helpers rawTypeToTypeInformation() should map a complex Promise types correctly 1`] = `
28+
exports[`markdown-helpers > rawTypeToTypeInformation() > should map a complex Promise types correctly 1`] = `
2929
{
3030
"collection": false,
3131
"innerTypes": [
@@ -47,7 +47,7 @@ exports[`markdown-helpers rawTypeToTypeInformation() should map a complex Promis
4747
}
4848
`;
4949

50-
exports[`markdown-helpers rawTypeToTypeInformation() should map a function return type + param types correctly 1`] = `
50+
exports[`markdown-helpers > rawTypeToTypeInformation() > should map a function return type + param types correctly 1`] = `
5151
{
5252
"collection": false,
5353
"parameters": [
@@ -68,7 +68,7 @@ exports[`markdown-helpers rawTypeToTypeInformation() should map a function retur
6868
}
6969
`;
7070

71-
exports[`markdown-helpers rawTypeToTypeInformation() should map a function return type correctly 1`] = `
71+
exports[`markdown-helpers > rawTypeToTypeInformation() > should map a function return type correctly 1`] = `
7272
{
7373
"collection": false,
7474
"parameters": [],
@@ -80,7 +80,7 @@ exports[`markdown-helpers rawTypeToTypeInformation() should map a function retur
8080
}
8181
`;
8282

83-
exports[`markdown-helpers rawTypeToTypeInformation() should map a function with complex return type + complex param types correctly 1`] = `
83+
exports[`markdown-helpers > rawTypeToTypeInformation() > should map a function with complex return type + complex param types correctly 1`] = `
8484
{
8585
"collection": false,
8686
"parameters": [
@@ -142,7 +142,7 @@ exports[`markdown-helpers rawTypeToTypeInformation() should map a function with
142142
}
143143
`;
144144

145-
exports[`markdown-helpers rawTypeToTypeInformation() should map a nested Function types correctly 1`] = `
145+
exports[`markdown-helpers > rawTypeToTypeInformation() > should map a nested Function types correctly 1`] = `
146146
{
147147
"collection": false,
148148
"innerTypes": [
@@ -169,7 +169,7 @@ exports[`markdown-helpers rawTypeToTypeInformation() should map a nested Functio
169169
}
170170
`;
171171

172-
exports[`markdown-helpers rawTypeToTypeInformation() should map a nested Promise types correctly 1`] = `
172+
exports[`markdown-helpers > rawTypeToTypeInformation() > should map a nested Promise types correctly 1`] = `
173173
{
174174
"collection": false,
175175
"innerTypes": [
@@ -197,7 +197,7 @@ exports[`markdown-helpers rawTypeToTypeInformation() should map a nested Promise
197197
}
198198
`;
199199

200-
exports[`markdown-helpers rawTypeToTypeInformation() should map a nested complex Promise types correctly 1`] = `
200+
exports[`markdown-helpers > rawTypeToTypeInformation() > should map a nested complex Promise types correctly 1`] = `
201201
{
202202
"collection": false,
203203
"innerTypes": [
@@ -225,7 +225,7 @@ exports[`markdown-helpers rawTypeToTypeInformation() should map a nested complex
225225
}
226226
`;
227227

228-
exports[`markdown-helpers rawTypeToTypeInformation() should map a nested complex Promise types correctly 2`] = `
228+
exports[`markdown-helpers > rawTypeToTypeInformation() > should map a nested complex Promise types correctly 2`] = `
229229
{
230230
"collection": false,
231231
"innerTypes": [
@@ -253,14 +253,14 @@ exports[`markdown-helpers rawTypeToTypeInformation() should map a nested complex
253253
}
254254
`;
255255

256-
exports[`markdown-helpers rawTypeToTypeInformation() should map a primitive types correctly 1`] = `
256+
exports[`markdown-helpers > rawTypeToTypeInformation() > should map a primitive types correctly 1`] = `
257257
{
258258
"collection": false,
259259
"type": "Boolean",
260260
}
261261
`;
262262

263-
exports[`markdown-helpers rawTypeToTypeInformation() should map a wrapped collection type correctly 1`] = `
263+
exports[`markdown-helpers > rawTypeToTypeInformation() > should map a wrapped collection type correctly 1`] = `
264264
{
265265
"collection": false,
266266
"innerTypes": [
@@ -287,24 +287,24 @@ exports[`markdown-helpers rawTypeToTypeInformation() should map a wrapped collec
287287
}
288288
`;
289289

290-
exports[`markdown-helpers rawTypeToTypeInformation() should map an unknown types correctly 1`] = `
290+
exports[`markdown-helpers > rawTypeToTypeInformation() > should map an unknown types correctly 1`] = `
291291
{
292292
"collection": false,
293293
"type": "MyType",
294294
}
295295
`;
296296

297-
exports[`markdown-helpers safelyJoinTokens snapshots should be correct for basic-paragraph 1`] = `"This is just a basic paragraph. It has multiple sentences and natural soft breaks."`;
297+
exports[`markdown-helpers > safelyJoinTokens > snapshots > should be correct for basic-paragraph 1`] = `"This is just a basic paragraph. It has multiple sentences and natural soft breaks."`;
298298

299-
exports[`markdown-helpers safelyJoinTokens snapshots should be correct for blockquotes 1`] = `
299+
exports[`markdown-helpers > safelyJoinTokens > snapshots > should be correct for blockquotes 1`] = `
300300
"This is a paragraph
301301
302302
> and here is a quote
303303
304304
and another paragraph"
305305
`;
306306

307-
exports[`markdown-helpers safelyJoinTokens snapshots should be correct for list-after-paragraph 1`] = `
307+
exports[`markdown-helpers > safelyJoinTokens > snapshots > should be correct for list-after-paragraph 1`] = `
308308
"This is a paragraph
309309
310310
* this
@@ -313,20 +313,20 @@ exports[`markdown-helpers safelyJoinTokens snapshots should be correct for list-
313313
* list"
314314
`;
315315

316-
exports[`markdown-helpers safelyJoinTokens snapshots should be correct for lists 1`] = `
316+
exports[`markdown-helpers > safelyJoinTokens > snapshots > should be correct for lists 1`] = `
317317
"* bar
318318
* thing
319319
* stuff
320320
* my tab key does not work and I am sad"
321321
`;
322322

323-
exports[`markdown-helpers safelyJoinTokens snapshots should be correct for multiple-paragraphs 1`] = `
323+
exports[`markdown-helpers > safelyJoinTokens > snapshots > should be correct for multiple-paragraphs 1`] = `
324324
"This is paragraph 1, it has a few sentences. Like this one, and a soft break.
325325
326326
And now this is a second paragraph, and it's also quite short with a soft break."
327327
`;
328328

329-
exports[`markdown-helpers safelyJoinTokens snapshots should be correct for nested-list 1`] = `
329+
exports[`markdown-helpers > safelyJoinTokens > snapshots > should be correct for nested-list 1`] = `
330330
"* top level
331331
* second level
332332
* back to top
@@ -335,13 +335,13 @@ exports[`markdown-helpers safelyJoinTokens snapshots should be correct for neste
335335
* now at third"
336336
`;
337337

338-
exports[`markdown-helpers safelyJoinTokens snapshots should be correct for paragraph-fence-removal 1`] = `
338+
exports[`markdown-helpers > safelyJoinTokens > snapshots > should be correct for paragraph-fence-removal 1`] = `
339339
"This fence should be removed
340340
341341
Hey"
342342
`;
343343

344-
exports[`markdown-helpers safelyJoinTokens snapshots should be correct for paragraph-with-br-tag 1`] = `
344+
exports[`markdown-helpers > safelyJoinTokens > snapshots > should be correct for paragraph-with-br-tag 1`] = `
345345
"Process: Main
346346
_This class is not exported from the \`'electron'\` module. It is only available as a return value of other methods in the Electron API._
347347
@@ -352,13 +352,13 @@ Process: Main
352352
_This class is not exported from the \`'electron'\` module. It is only available as a return value of other methods in the Electron API._"
353353
`;
354354

355-
exports[`markdown-helpers safelyJoinTokens snapshots should be correct for paragraph-with-inline-code 1`] = `"This is a \`inline code\` block that is \`code\` tagged."`;
355+
exports[`markdown-helpers > safelyJoinTokens > snapshots > should be correct for paragraph-with-inline-code 1`] = `"This is a \`inline code\` block that is \`code\` tagged."`;
356356

357-
exports[`markdown-helpers safelyJoinTokens snapshots should be correct for paragraph-with-links 1`] = `"This paragraph has a bunch of stuff. Also some links Foo, these links should be stripped."`;
357+
exports[`markdown-helpers > safelyJoinTokens > snapshots > should be correct for paragraph-with-links 1`] = `"This paragraph has a bunch of stuff. Also some links Foo, these links should be stripped."`;
358358

359-
exports[`markdown-helpers safelyJoinTokens snapshots should be correct for paragraph-with-text-markers 1`] = `"Heya, this is **bold** and _italic_ and *italic* and ~~struck through~~"`;
359+
exports[`markdown-helpers > safelyJoinTokens > snapshots > should be correct for paragraph-with-text-markers 1`] = `"Heya, this is **bold** and _italic_ and *italic* and ~~struck through~~"`;
360360

361-
exports[`markdown-helpers safelyJoinTokens with code fence support should correctly insert the code fence 1`] = `
361+
exports[`markdown-helpers > safelyJoinTokens > with code fence support > should correctly insert the code fence 1`] = `
362362
"> a
363363
364364
\`\`\`

tests/block-parsers.spec.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};

tests/block-parsers.spec.js

+110
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/block-parsers.spec.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/__tests__/block-parsers.spec.ts tests/block-parsers.spec.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import MarkdownIt from 'markdown-it';
2-
import { parseMethodBlocks } from '../block-parsers';
2+
import { describe, expect, it } from 'vitest';
3+
4+
import { parseMethodBlocks } from '../src/block-parsers';
35

46
describe('block parsers', () => {
57
it('should parse a method', async () => {
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/helpers.spec.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};

tests/helpers.spec.js

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/helpers.spec.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)