Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test runner does not wait for web worker to terminate #21007

Open
scarf005 opened this issue Oct 28, 2023 · 1 comment
Open

Test runner does not wait for web worker to terminate #21007

scarf005 opened this issue Oct 28, 2023 · 1 comment
Labels
bug Something isn't working needs investigation requires further investigation before determining if it is an issue or not testing related to deno test and coverage

Comments

@scarf005
Copy link
Contributor

scarf005 commented Oct 28, 2023

Summary

test runners do not wait for web workers to terminate.

Minimal reproduction

// a.ts
setTimeout(() => console.log("hello"), 1000)
// a_test.ts
const foo = () => {
	const worker = new Worker(new URL("./a.ts", import.meta.url), { type: "module" })

	return new Promise(() => worker.terminate())
}

Deno.test("wait for worker", async () => {
    console.log("begin")
	await foo()
    console.log("end")
})

Actual behavior

running 1 test from ./a_test.ts
wait for worser ...
------- output -------
begin
Check file:///home/scarf/repo/w1-social-feed/a.ts

ok | 0 passed | 0 failed (110ms)

error: Promise resolution is still pending but the event loop has already resolved.

System Info

deno 1.37.2+8f065a6 (canary, x86_64-unknown-linux-gnu)
v8 11.8.172.13
typescript 5.2.2
Ubuntu 23.04
scarf005 added a commit to wanted-7h/social-feed that referenced this issue Oct 28, 2023
scarf005 added a commit to wanted-7h/social-feed that referenced this issue Oct 29, 2023
* feat: user 테이블에 이름 및 이메일 인증 여부 추가

* feat: otp 생성 함수

* refactor: 비밀번호 스키마 분리

* test: 비밀번호 규칙 검사

* feat: 회원가입 컨트롤러

* feat: 회원가입 및 OTP 검증 경로

* refactor: otp 생성 알고리즘 단순화

* refactor: 스키마 분리

* fix: 마이그레이션시 race condition

* fix: 계정명과 태그명을 unique로 변경

* build: 타입 생성후 포매팅 적용

* feat: otp 테이블 생성

* feat: 회원가입 및 otp 인증

* test: 회원가입 테스트

web worker 이슈: denoland/deno#21007

* style: 포매팅

* fix: 트랜잭션 안에서 `db` 사용 금지

트랜잭션 안에서 `trx` 변수가 아닌 `db`를 사용했기 때문에 트랜잭션이 제대로 동작하지 않았습니다.
@bartlomieju bartlomieju added bug Something isn't working needs investigation requires further investigation before determining if it is an issue or not testing related to deno test and coverage labels Nov 1, 2023
@loynoir
Copy link

loynoir commented Apr 6, 2024

Hello @scarf005, FYI, workaround exists, don't await p, but await pWrapper(p, timeout)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs investigation requires further investigation before determining if it is an issue or not testing related to deno test and coverage
Projects
None yet
Development

No branches or pull requests

3 participants