Skip to content

Commit

Permalink
Switch from jest to vitest (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubk authored Nov 10, 2024
1 parent f9a4631 commit dea8a10
Show file tree
Hide file tree
Showing 12 changed files with 138 additions and 128 deletions.
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"types": "dist/mobx-log.d.ts",
"scripts": {
"build": "rollup -c",
"test": "jest test --passWithNoTests",
"test:update-snapshot": "jest test --updateSnapshot",
"test:cache": "jest test --clearCache",
"test": "npx vitest",
"prepublishOnly": "npm run build",
"prepare": "husky install"
},
Expand Down Expand Up @@ -43,11 +41,10 @@
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-typescript": "^9.0.2",
"@size-limit/preset-small-lib": "^5.0.3",
"@types/jest": "^27.0.3",
"@types/react": "^17.0.21",
"@types/react-dom": "^17.0.9",
"husky": "^8.0.0",
"jest": "^27.4.5",
"jsdom": "^25.0.1",
"mobx": "^6.3.5",
"mobx-react-lite": "^3.2.1",
"prettier": "^2.4.1",
Expand All @@ -57,8 +54,8 @@
"rollup": "^2.61.1",
"rollup-plugin-dts": "^4.0.1",
"size-limit": "^5.0.3",
"ts-jest": "^27.1.2",
"tslib": "^2.3.1",
"typescript": "^4.8.2"
"typescript": "^4.8.2",
"vitest": "^2.1.4"
}
}
4 changes: 2 additions & 2 deletions src/__snapshots__/config.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`config - filters respects filters 1`] = `Array []`;
exports[`config - filters > respects filters 1`] = `[]`;
50 changes: 25 additions & 25 deletions src/__snapshots__/make-loggable.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

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

exports[`makeLoggable can filter specific events of a store 2`] = `
Array [
exports[`makeLoggable > can filter specific events of a store 2`] = `
[
"%c[A]%c Counter.increment() color:#FF6157 color:inherit",
"%c[A]%c Counter.increment() color:#FF6157 color:inherit",
]
`;

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

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

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

exports[`makeLoggable logs action with { autoBind: true } 1`] = `
Array [
exports[`makeLoggable > logs action with { autoBind: true } 1`] = `
[
"%c[A]%c StoreDestructuringAutoBind.increment() color:#FF6157 color:inherit",
"%c[O] color:#FFBC2D StoreDestructuringAutoBind.value 0 -> 1",
"%c[A]%c StoreDestructuringAutoBind.increment() color:#FF6157 color:inherit",
"%c[O] color:#FFBC2D StoreDestructuringAutoBind.value 1 -> 2",
]
`;

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

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

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

exports[`makeLoggable logs observable set 1`] = `
Array [
exports[`makeLoggable > logs observable set 1`] = `
[
"%c[A]%c ParticipantStore.adminUserAdd(%o) color:#FF6157 color:inherit 1",
"%c[O] color:#FFBC2D ParticipantStore.adminUsers - added 1",
"%c[A]%c ParticipantStore.adminUserAdd(%o) color:#FF6157 color:inherit 2",
Expand All @@ -103,8 +103,8 @@ Array [
]
`;

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

exports[`makeLoggable works with factory function store 1`] = `
Array [
exports[`makeLoggable > works with factory function store 1`] = `
[
"%c[A]%c counter.increment() color:#FF6157 color:inherit",
"%c[A]%c counter.increment() color:#FF6157 color:inherit",
"%c[A]%c counter.increment() color:#FF6157 color:inherit",
Expand Down
Loading

0 comments on commit dea8a10

Please sign in to comment.