From 8e27503be762738226accfeb4e5675fcbbd4d1dc Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 8 Dec 2023 14:23:46 +0800 Subject: [PATCH] test: fix for vitest upgrade --- .github/workflows/build-test.yml | 2 +- packages/frontend/electron/test/db/migration.spec.ts | 9 +++++---- packages/frontend/graphql/src/__tests__/fetcher.spec.ts | 4 ++-- vitest.config.ts | 1 + 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index cb26bc18c1a6e..b2b3419ef771f 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -222,7 +222,7 @@ jobs: path: ./packages/frontend/native - name: Unit Test - run: yarn nx test:coverage @affine/monorepo + run: yarn workspace @affine/monorepo test:coverage - name: Upload unit test coverage results uses: codecov/codecov-action@v3 diff --git a/packages/frontend/electron/test/db/migration.spec.ts b/packages/frontend/electron/test/db/migration.spec.ts index 809e05e3b8424..33a624012df74 100644 --- a/packages/frontend/electron/test/db/migration.spec.ts +++ b/packages/frontend/electron/test/db/migration.spec.ts @@ -1,14 +1,15 @@ import path from 'node:path'; -import { - copyToTemp, - migrateToSubdocAndReplaceDatabase, -} from '@affine/electron/helper/db/migration'; import { SqliteConnection } from '@affine/native'; import { removeWithRetry } from '@affine-test/kit/utils/utils'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { applyUpdate, Doc as YDoc } from 'yjs'; +import { + copyToTemp, + migrateToSubdocAndReplaceDatabase, +} from '../../src/helper/db/migration'; + const tmpDir = path.join(__dirname, 'tmp'); const testDBFilePath = path.resolve(__dirname, 'old-db.affine'); diff --git a/packages/frontend/graphql/src/__tests__/fetcher.spec.ts b/packages/frontend/graphql/src/__tests__/fetcher.spec.ts index 50369f6fb39af..586293ae0aa55 100644 --- a/packages/frontend/graphql/src/__tests__/fetcher.spec.ts +++ b/packages/frontend/graphql/src/__tests__/fetcher.spec.ts @@ -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({ @@ -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"}"` ); }); diff --git a/vitest.config.ts b/vitest.config.ts index 927a23e2bd374..8235c68e8fe5d 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -34,6 +34,7 @@ export default defineConfig({ '**/build', '**/out,', '**/frontend/electron', + 'packages/backend/**', ], testTimeout: 5000, coverage: {