From 6a716cdf40100a53ac9abd9004e89d35f0d0ea1a Mon Sep 17 00:00:00 2001 From: stygian-desolator <73412177+stygian-desolator@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:08:20 +0800 Subject: [PATCH 1/2] fix: remove `describe` async support --- packages/vitest/src/types/tasks.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vitest/src/types/tasks.ts b/packages/vitest/src/types/tasks.ts index 2542934986d6..d2c79c395e85 100644 --- a/packages/vitest/src/types/tasks.ts +++ b/packages/vitest/src/types/tasks.ts @@ -78,7 +78,7 @@ export interface SuiteCollector { on: (name: T, ...fn: SuiteHooks[T]) => void } -export type SuiteFactory = (test: (name: string, fn: TestFunction) => void) => Awaitable +export type SuiteFactory = (test: (name: string, fn: TestFunction) => void) => void export interface RuntimeContext { tasks: (SuiteCollector | Test)[] From e2fe4eebce392b5c6ab9103a71a29247d2e1ea70 Mon Sep 17 00:00:00 2001 From: stygian-desolator <73412177+stygian-desolator@users.noreply.github.com> Date: Sun, 13 Feb 2022 20:50:16 +0800 Subject: [PATCH 2/2] docs: remove the use of async describe from the examples --- examples/lit/test/basic.test.ts | 2 +- examples/puppeteer/test/basic.test.ts | 2 +- examples/react-testing-lib/src/components/input.test.tsx | 2 +- test/fails/test/runner.test.ts | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/lit/test/basic.test.ts b/examples/lit/test/basic.test.ts index 4199e2fba677..8d7fd1a97ac6 100644 --- a/examples/lit/test/basic.test.ts +++ b/examples/lit/test/basic.test.ts @@ -7,7 +7,7 @@ declare global { interface Window extends IWindow {} } -describe('Button with increment', async() => { +describe('Button with increment', () => { beforeEach(async() => { document.body.innerHTML = '' await window.happyDOM.whenAsyncComplete() diff --git a/examples/puppeteer/test/basic.test.ts b/examples/puppeteer/test/basic.test.ts index fd6abbcc98ef..4a776703b1a2 100644 --- a/examples/puppeteer/test/basic.test.ts +++ b/examples/puppeteer/test/basic.test.ts @@ -4,7 +4,7 @@ import type { PreviewServer } from 'vite' import puppeteer from 'puppeteer' import type { Browser, Page } from 'puppeteer' -describe('basic', async() => { +describe('basic', () => { let server: PreviewServer let browser: Browser let page: Page diff --git a/examples/react-testing-lib/src/components/input.test.tsx b/examples/react-testing-lib/src/components/input.test.tsx index 9ed1c72a78b7..51179878cf96 100644 --- a/examples/react-testing-lib/src/components/input.test.tsx +++ b/examples/react-testing-lib/src/components/input.test.tsx @@ -2,7 +2,7 @@ import '@testing-library/jest-dom' import { render, screen, userEvent } from '../utils/test-utils' import { Input } from './Input' -describe('Input', async() => { +describe('Input', () => { it('should render the input', () => { render( { +describe('should fails', () => { const root = resolve(__dirname, '../fixtures') - const files = await fg('*.test.ts', { cwd: root }) + const files = fg.sync('*.test.ts', { cwd: root }) for (const file of files) { it(file, async() => {