Skip to content

Commit dea8a10

Browse files
authored
Switch from jest to vitest (#45)
1 parent f9a4631 commit dea8a10

12 files changed

+138
-128
lines changed

package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
"types": "dist/mobx-log.d.ts",
1414
"scripts": {
1515
"build": "rollup -c",
16-
"test": "jest test --passWithNoTests",
17-
"test:update-snapshot": "jest test --updateSnapshot",
18-
"test:cache": "jest test --clearCache",
16+
"test": "npx vitest",
1917
"prepublishOnly": "npm run build",
2018
"prepare": "husky install"
2119
},
@@ -43,11 +41,10 @@
4341
"@rollup/plugin-node-resolve": "^15.0.1",
4442
"@rollup/plugin-typescript": "^9.0.2",
4543
"@size-limit/preset-small-lib": "^5.0.3",
46-
"@types/jest": "^27.0.3",
4744
"@types/react": "^17.0.21",
4845
"@types/react-dom": "^17.0.9",
4946
"husky": "^8.0.0",
50-
"jest": "^27.4.5",
47+
"jsdom": "^25.0.1",
5148
"mobx": "^6.3.5",
5249
"mobx-react-lite": "^3.2.1",
5350
"prettier": "^2.4.1",
@@ -57,8 +54,8 @@
5754
"rollup": "^2.61.1",
5855
"rollup-plugin-dts": "^4.0.1",
5956
"size-limit": "^5.0.3",
60-
"ts-jest": "^27.1.2",
6157
"tslib": "^2.3.1",
62-
"typescript": "^4.8.2"
58+
"typescript": "^4.8.2",
59+
"vitest": "^2.1.4"
6360
}
6461
}

src/__snapshots__/config.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`config - filters respects filters 1`] = `Array []`;
3+
exports[`config - filters > respects filters 1`] = `[]`;

src/__snapshots__/make-loggable.test.ts.snap

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`makeLoggable can filter specific events of a store 1`] = `
4-
Array [
3+
exports[`makeLoggable > can filter specific events of a store 1`] = `
4+
[
55
"%c[C] color:#28B7F6 Counter.isEven [object Object] -> true",
66
"%c[O] color:#FFBC2D Counter.value 0 -> 1",
77
"%c[C] color:#28B7F6 Counter.isEven true -> false",
@@ -10,22 +10,22 @@ Array [
1010
]
1111
`;
1212

13-
exports[`makeLoggable can filter specific events of a store 2`] = `
14-
Array [
13+
exports[`makeLoggable > can filter specific events of a store 2`] = `
14+
[
1515
"%c[A]%c Counter.increment() color:#FF6157 color:inherit",
1616
"%c[A]%c Counter.increment() color:#FF6157 color:inherit",
1717
]
1818
`;
1919

20-
exports[`makeLoggable does not log action with class properties 1`] = `
21-
Array [
20+
exports[`makeLoggable > does not log action with class properties 1`] = `
21+
[
2222
"%c[O] color:#FFBC2D StoreDestructuringClassProperties.value 0 -> 1",
2323
"%c[O] color:#FFBC2D StoreDestructuringClassProperties.value 1 -> 2",
2424
]
2525
`;
2626

27-
exports[`makeLoggable logs 1`] = `
28-
Array [
27+
exports[`makeLoggable > logs 1`] = `
28+
[
2929
"%c[C] color:#28B7F6 StoreWithComputed.isDividedBy3 [object Object] -> true",
3030
"%c[A]%c StoreWithComputed.increment() color:#FF6157 color:inherit",
3131
"%c[O] color:#FFBC2D StoreWithComputed.value 0 -> 1",
@@ -34,8 +34,8 @@ Array [
3434
]
3535
`;
3636

37-
exports[`makeLoggable logs 2`] = `
38-
Array [
37+
exports[`makeLoggable > logs 2`] = `
38+
[
3939
"%c[C] color:#28B7F6 StoreWithComputed.isDividedBy3 [object Object] -> true",
4040
"%c[A]%c StoreWithComputed.increment() color:#FF6157 color:inherit",
4141
"%c[O] color:#FFBC2D StoreWithComputed.value 0 -> 1",
@@ -49,33 +49,33 @@ Array [
4949
]
5050
`;
5151

52-
exports[`makeLoggable logs action with { autoBind: true } 1`] = `
53-
Array [
52+
exports[`makeLoggable > logs action with { autoBind: true } 1`] = `
53+
[
5454
"%c[A]%c StoreDestructuringAutoBind.increment() color:#FF6157 color:inherit",
5555
"%c[O] color:#FFBC2D StoreDestructuringAutoBind.value 0 -> 1",
5656
"%c[A]%c StoreDestructuringAutoBind.increment() color:#FF6157 color:inherit",
5757
"%c[O] color:#FFBC2D StoreDestructuringAutoBind.value 1 -> 2",
5858
]
5959
`;
6060

61-
exports[`makeLoggable logs array changes correctly 1`] = `
62-
Array [
61+
exports[`makeLoggable > logs array changes correctly 1`] = `
62+
[
6363
"%c[A]%c TodoStore.addTodo(%o, %o) color:#FF6157 color:inherit 1 Play balalaika",
6464
"%c[O] color:#FFBC2D TodoStore.todos has changed. Added: [object Object]",
6565
]
6666
`;
6767

68-
exports[`makeLoggable logs array changes correctly 2`] = `
69-
Array [
68+
exports[`makeLoggable > logs array changes correctly 2`] = `
69+
[
7070
"%c[A]%c TodoStore.addTodo(%o, %o) color:#FF6157 color:inherit 1 Play balalaika",
7171
"%c[O] color:#FFBC2D TodoStore.todos has changed. Added: [object Object]",
7272
"%c[A]%c TodoStore.markAsDone(%o) color:#FF6157 color:inherit 1",
7373
"%c[O] color:#FFBC2D TodoStore.todos[..].isDone false -> true",
7474
]
7575
`;
7676

77-
exports[`makeLoggable logs observable and observable map 1`] = `
78-
Array [
77+
exports[`makeLoggable > logs observable and observable map 1`] = `
78+
[
7979
"%c[A]%c ParticipantStore.onlineUserSet(%o, %o) color:#FF6157 color:inherit 1 true",
8080
"%c[O] color:#FFBC2D ParticipantStore.onlineUsers - added 1 : true",
8181
"%c[A]%c ParticipantStore.onlineUserSet(%o, %o) color:#FF6157 color:inherit 2 true",
@@ -87,8 +87,8 @@ Array [
8787
]
8888
`;
8989

90-
exports[`makeLoggable logs observable set 1`] = `
91-
Array [
90+
exports[`makeLoggable > logs observable set 1`] = `
91+
[
9292
"%c[A]%c ParticipantStore.adminUserAdd(%o) color:#FF6157 color:inherit 1",
9393
"%c[O] color:#FFBC2D ParticipantStore.adminUsers - added 1",
9494
"%c[A]%c ParticipantStore.adminUserAdd(%o) color:#FF6157 color:inherit 2",
@@ -103,8 +103,8 @@ Array [
103103
]
104104
`;
105105

106-
exports[`makeLoggable logs plain array changes correctly 1`] = `
107-
Array [
106+
exports[`makeLoggable > logs plain array changes correctly 1`] = `
107+
[
108108
"%c[A]%c StoreOnlyObservables.add() color:#FF6157 color:inherit",
109109
"%c[O] color:#FFBC2D StoreOnlyObservables.numbers has changed. Added: 1",
110110
"%c[A]%c StoreOnlyObservables.add() color:#FF6157 color:inherit",
@@ -126,8 +126,8 @@ Array [
126126
]
127127
`;
128128

129-
exports[`makeLoggable works with factory function store 1`] = `
130-
Array [
129+
exports[`makeLoggable > works with factory function store 1`] = `
130+
[
131131
"%c[A]%c counter.increment() color:#FF6157 color:inherit",
132132
"%c[A]%c counter.increment() color:#FF6157 color:inherit",
133133
"%c[A]%c counter.increment() color:#FF6157 color:inherit",

0 commit comments

Comments
 (0)