Skip to content

Commit

Permalink
chore: bump up vitest monorepo to v1
Browse files Browse the repository at this point in the history
  • Loading branch information
EYHN committed Dec 18, 2023
1 parent a1c9ac8 commit 9858c2f
Show file tree
Hide file tree
Showing 16 changed files with 188 additions and 188 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
"@vanilla-extract/vite-plugin": "^3.9.2",
"@vanilla-extract/webpack-plugin": "^2.3.1",
"@vitejs/plugin-react-swc": "^3.5.0",
"@vitest/coverage-istanbul": "0.34.6",
"@vitest/ui": "0.34.6",
"@vitest/coverage-istanbul": "1.0.4",
"@vitest/ui": "1.0.4",
"electron": "^27.1.0",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
Expand Down Expand Up @@ -111,7 +111,7 @@
"vite-plugin-istanbul": "^5.0.0",
"vite-plugin-static-copy": "^1.0.0",
"vite-tsconfig-paths": "^4.2.1",
"vitest": "0.34.6",
"vitest": "1.0.4",
"vitest-fetch-mock": "^0.2.2",
"vitest-mock-extended": "^1.3.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/common/debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"devDependencies": {
"@types/debug": "^4.1.9",
"vitest": "0.34.6"
"vitest": "1.0.4"
},
"version": "0.10.3-canary.2"
}
2 changes: 1 addition & 1 deletion packages/common/env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@blocksuite/store": "0.11.0-nightly-202312150424-f13b992",
"react": "18.2.0",
"react-dom": "18.2.0",
"vitest": "0.34.6",
"vitest": "1.0.4",
"zod": "^3.22.4"
},
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"rxjs": "^7.8.1",
"vite": "^5.0.6",
"vite-plugin-dts": "3.6.0",
"vitest": "0.34.6",
"vitest": "1.0.4",
"yjs": "^13.6.10"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/y-indexeddb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"fake-indexeddb": "^5.0.0",
"vite": "^5.0.6",
"vite-plugin-dts": "3.6.0",
"vitest": "0.34.6",
"vitest": "1.0.4",
"y-indexeddb": "^9.0.11",
"yjs": "^13.6.10"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/common/y-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@blocksuite/store": "0.11.0-nightly-202312150424-f13b992",
"vite": "^5.0.6",
"vite-plugin-dts": "3.6.0",
"vitest": "0.34.6",
"vitest": "1.0.4",
"yjs": "^13.6.10"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"storybook-dark-mode": "^3.0.1",
"typescript": "^5.3.2",
"vite": "^5.0.6",
"vitest": "0.34.6",
"vitest": "1.0.4",
"yjs": "^13.6.10"
},
"version": "0.10.3-canary.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"swc-loader": "^0.2.3",
"swc-plugin-coverage-instrument": "^0.0.20",
"thread-loader": "^4.0.2",
"vitest": "0.34.6",
"vitest": "1.0.4",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"ts-node": "^10.9.1",
"undici": "^6.0.0",
"uuid": "^9.0.1",
"vitest": "0.34.6",
"vitest": "1.0.4",
"which": "^4.0.0",
"zod": "^3.22.4"
},
Expand Down
8 changes: 6 additions & 2 deletions packages/frontend/electron/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ export default defineConfig({
'@affine/electron': resolve(rootDir, 'packages/frontend/electron/src'),
},
},

test: {
include: ['./test/**/*.spec.ts'],
testTimeout: 5000,
singleThread: true,
threads: false,
poolOptions: {
threads: {
singleThread: true,
},
},
coverage: {
provider: 'istanbul', // or 'c8'
reporter: ['lcov'],
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"prettier": "^3.0.3",
"vitest": "0.34.6"
"vitest": "1.0.4"
},
"scripts": {
"postinstall": "gql-gen --errors-only"
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/graphql/src/__tests__/fetcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('GraphQL fetcher', () => {
});

expect(fetch.mock.lastCall[1].body).toMatchInlineSnapshot(
'"{\\"query\\":\\"query { field }\\",\\"variables\\":{\\"a\\":false,\\"b\\":null},\\"operationName\\":\\"query\\"}"'
`"{"query":"query { field }","variables":{"a":false,"b":null},"operationName":"query"}"`
);

await gql({
Expand All @@ -91,7 +91,7 @@ describe('GraphQL fetcher', () => {
});

expect(fetch.mock.lastCall[1].body).toMatchInlineSnapshot(
'"{\\"query\\":\\"query { field }\\",\\"variables\\":{\\"a\\":false},\\"operationName\\":\\"query\\"}"'
`"{"query":"query { field }","variables":{"a":false},"operationName":"query"}"`
);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@types/image-blob-reduce": "^4.1.3",
"@types/lodash.debounce": "^4.0.7",
"fake-indexeddb": "^5.0.0",
"vitest": "0.34.6",
"vitest": "1.0.4",
"y-provider": "workspace:*"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/workspace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@testing-library/react": "^14.0.0",
"@types/ws": "^8.5.7",
"fake-indexeddb": "^5.0.0",
"vitest": "0.34.6",
"vitest": "1.0.4",
"ws": "^8.14.2"
},
"version": "0.10.3-canary.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import 'fake-indexeddb/auto';

import { setTimeout } from 'node:timers/promises';

import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
import { Schema, Workspace } from '@blocksuite/store';
import { beforeEach, describe, expect, test, vi } from 'vitest';
Expand Down Expand Up @@ -127,46 +125,54 @@ describe('SyncEngine', () => {
expect(syncEngine.status.step).toEqual(SyncEngineStep.Stopped);

syncEngine.start();
await setTimeout(100);

expect(syncEngine.status.step).toEqual(SyncEngineStep.Syncing);
expect(syncEngine.status.local?.step).toEqual(SyncPeerStep.LoadingRootDoc);
await vi.waitFor(() => {
expect(syncEngine.status.step).toEqual(SyncEngineStep.Syncing);
expect(syncEngine.status.local?.step).toEqual(
SyncPeerStep.LoadingRootDoc
);
});

localStorage.resumePull();
await setTimeout(100);

expect(syncEngine.status.step).toEqual(SyncEngineStep.Syncing);
expect(syncEngine.status.local?.step).toEqual(SyncPeerStep.Synced);
expect(syncEngine.status.remotes[0]?.step).toEqual(
SyncPeerStep.LoadingRootDoc
);
await vi.waitFor(() => {
expect(syncEngine.status.step).toEqual(SyncEngineStep.Syncing);
expect(syncEngine.status.local?.step).toEqual(SyncPeerStep.Synced);
expect(syncEngine.status.remotes[0]?.step).toEqual(
SyncPeerStep.LoadingRootDoc
);
});

remoteStorage.resumePull();
await setTimeout(100);

expect(syncEngine.status.step).toEqual(SyncEngineStep.Synced);
expect(syncEngine.status.local?.step).toEqual(SyncPeerStep.Synced);
expect(syncEngine.status.remotes[0]?.step).toEqual(SyncPeerStep.Synced);
await vi.waitFor(() => {
expect(syncEngine.status.step).toEqual(SyncEngineStep.Synced);
expect(syncEngine.status.remotes[0]?.step).toEqual(SyncPeerStep.Synced);
expect(syncEngine.status.local?.step).toEqual(SyncPeerStep.Synced);
});

ydoc.getArray('test').insert(0, [1, 2, 3]);
await setTimeout(100);

expect(syncEngine.status.step).toEqual(SyncEngineStep.Syncing);
expect(syncEngine.status.local?.step).toEqual(SyncPeerStep.Syncing);
expect(syncEngine.status.remotes[0]?.step).toEqual(SyncPeerStep.Syncing);
await vi.waitFor(() => {
expect(syncEngine.status.step).toEqual(SyncEngineStep.Syncing);
expect(syncEngine.status.local?.step).toEqual(SyncPeerStep.Syncing);
expect(syncEngine.status.remotes[0]?.step).toEqual(SyncPeerStep.Syncing);
});

localStorage.resumePush();
await setTimeout(100);

expect(syncEngine.status.step).toEqual(SyncEngineStep.Syncing);
expect(syncEngine.status.local?.step).toEqual(SyncPeerStep.Synced);
expect(syncEngine.status.remotes[0]?.step).toEqual(SyncPeerStep.Syncing);
await vi.waitFor(() => {
expect(syncEngine.status.step).toEqual(SyncEngineStep.Syncing);
expect(syncEngine.status.local?.step).toEqual(SyncPeerStep.Synced);
expect(syncEngine.status.remotes[0]?.step).toEqual(SyncPeerStep.Syncing);
});

remoteStorage.resumePush();
await setTimeout(100);

expect(syncEngine.status.step).toEqual(SyncEngineStep.Synced);
expect(syncEngine.status.local?.step).toEqual(SyncPeerStep.Synced);
expect(syncEngine.status.remotes[0]?.step).toEqual(SyncPeerStep.Synced);
await vi.waitFor(() => {
expect(syncEngine.status.step).toEqual(SyncEngineStep.Synced);
expect(syncEngine.status.local?.step).toEqual(SyncPeerStep.Synced);
expect(syncEngine.status.remotes[0]?.step).toEqual(SyncPeerStep.Synced);
});
});
});
Loading

0 comments on commit 9858c2f

Please sign in to comment.