Skip to content

Vitest not working with uwebsockets.js #5576

@chanon

Description

@chanon

Describe the bug

Just calling uwebsocket's App() will terminate the test and Vitest will not show results of any tests.

I have tried looking through the Vitest documentation to see what the problem could be, but did not find anything.

Reproduction

Complete minimal reproduction in github repo:
https://github.com/chanon/vitest-uws/

The test code in tests/minimal.test.ts:

import { test } from "vitest"
import { App } from 'uWebSockets.js'

test("test it", async () => {
	try {
		console.log('before App()')
		// try commenting out the App() call
		App()
		console.log('after App()')
	}
	catch (e) {
		console.log(e)
	}
})

Run

pnpm install
pnpm vitest

Result:

image

Comment App() call and run again.

Result:

image

System Info

(Relevant info:)

 System:
    OS: Windows 10 
  Binaries:
    Node: 20.9.0
    pnpm: 9.0.4

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions