From 9cf159565c6b170380308828d9101acc7b3d3ea7 Mon Sep 17 00:00:00 2001 From: beefchimi Date: Sat, 7 Dec 2024 12:45:08 -0500 Subject: [PATCH] :test_tube: [Tests] Fix failing tests + bad Vitest config --- pkg/earwurm/src/Stack.ts | 4 ++-- pkg/earwurm/src/tests/Stack.test.ts | 3 +-- pkg/earwurm/vite.config.ts | 2 ++ pkg/earwurm/vitest.config.ts | 14 -------------- vitest.config.ts | 8 +++++--- 5 files changed, 10 insertions(+), 21 deletions(-) delete mode 100644 pkg/earwurm/vitest.config.ts diff --git a/pkg/earwurm/src/Stack.ts b/pkg/earwurm/src/Stack.ts index f05af7d..d451708 100644 --- a/pkg/earwurm/src/Stack.ts +++ b/pkg/earwurm/src/Stack.ts @@ -18,7 +18,7 @@ export class Stack extends EmittenCommon { static readonly #loadError = ( id: StackId, path: string, - error: string, + error: unknown, ): StackError => ({ id, message: [`Failed to load: ${path}`, getErrorMessage(error)], @@ -170,7 +170,7 @@ export class Stack extends EmittenCommon { ).catch((error) => { this.emit( 'error', - Stack.#loadError(this.id, this.path, getErrorMessage(error)), + Stack.#loadError(this.id, this.path, error), ); return scratchBuffer(this.context); diff --git a/pkg/earwurm/src/tests/Stack.test.ts b/pkg/earwurm/src/tests/Stack.test.ts index 68ef598..dcd78c8 100644 --- a/pkg/earwurm/src/tests/Stack.test.ts +++ b/pkg/earwurm/src/tests/Stack.test.ts @@ -415,8 +415,7 @@ describe('Stack component', () => { id: mockStackId, message: [ `Failed to load: ${mockPath}`, - // This string ends with `[object Request]`. - expect.stringContaining('Failed to parse URL from'), + expect.stringContaining('Failed to execute'), ], }); }); diff --git a/pkg/earwurm/vite.config.ts b/pkg/earwurm/vite.config.ts index 1686b38..d30b169 100644 --- a/pkg/earwurm/vite.config.ts +++ b/pkg/earwurm/vite.config.ts @@ -4,6 +4,8 @@ import dts from 'vite-plugin-dts'; import pkg from './package.json'; +// TODO: We may need a unique `vitest.config.ts` file for this +// package... but simply adding that file does not appear to work. export default defineConfig({ build: { lib: { diff --git a/pkg/earwurm/vitest.config.ts b/pkg/earwurm/vitest.config.ts deleted file mode 100644 index 364d4cb..0000000 --- a/pkg/earwurm/vitest.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import {defineConfig, mergeConfig} from 'vitest/config'; -import earuwrmViteConfig from './vite.config'; - -export default mergeConfig( - earuwrmViteConfig, - defineConfig({ - test: { - setupFiles: 'config/tests-setup', - sequence: { - concurrent: true, - }, - }, - }), -); diff --git a/vitest.config.ts b/vitest.config.ts index 53f429e..1608feb 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -5,10 +5,12 @@ export default mergeConfig( viteConfig, defineConfig({ test: { + environment: 'happy-dom', setupFiles: 'config/tests-setup', - sequence: { - concurrent: true, - }, + // Not running tests concurrently because we would + // need to refactor many tests to more thoroughly reset + // between each test. + // sequence: {concurrent: true}, }, }), );