Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion test/webview/ui/useVscodeTheme.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { act, renderHook } from "@testing-library/react";
import { act, cleanup, renderHook } from "@testing-library/react";
import { afterEach, describe, expect, it } from "vitest";

import { useVscodeTheme } from "@repo/ui";
Expand All @@ -12,6 +12,9 @@ function setThemeKind(kind: string | undefined): void {
}

afterEach(() => {
// Unmount before clearing the attribute so the MutationObserver
// callback doesn't trigger a state update on a mounted component.
cleanup();
setThemeKind(undefined);
});

Expand Down
23 changes: 16 additions & 7 deletions vitest.config.ts → vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from "node:path";
import { defineConfig } from "vitest/config";

const webviewSharedAlias = path.resolve(
__dirname,
import.meta.dirname,
"packages/webview-shared/src",
);

Expand All @@ -24,9 +24,12 @@ export default defineConfig({
},
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
"@": path.resolve(import.meta.dirname, "src"),
"@repo/webview-shared": webviewSharedAlias,
vscode: path.resolve(__dirname, "test/mocks/vscode.runtime.ts"),
vscode: path.resolve(
import.meta.dirname,
"test/mocks/vscode.runtime.ts",
),
},
},
},
Expand All @@ -43,11 +46,17 @@ export default defineConfig({
resolve: {
alias: {
"@repo/webview-shared": webviewSharedAlias,
"@repo/tasks": path.resolve(__dirname, "packages/tasks/src"),
"@repo/ui": path.resolve(__dirname, "packages/ui/src"),
"@repo/netcheck": path.resolve(__dirname, "packages/netcheck/src"),
"@repo/tasks": path.resolve(
import.meta.dirname,
"packages/tasks/src",
),
"@repo/ui": path.resolve(import.meta.dirname, "packages/ui/src"),
"@repo/netcheck": path.resolve(
import.meta.dirname,
"packages/netcheck/src",
),
"@repo/speedtest": path.resolve(
__dirname,
import.meta.dirname,
"packages/speedtest/src",
),
},
Expand Down