testing-library / svelte-testing-library

:chipmunk: Simple and complete Svelte DOM testing utilities that encourage good testing practices
https://testing-library.com/docs/svelte-testing-library/intro
MIT License
614 stars 33 forks source link

svelte5: "TypeError: act is not a function" on 4.2.2 #342

Closed sureshjoshi closed 5 months ago

sureshjoshi commented 6 months ago

Hi!

Just tried out 4.2.2 with Svelte 5 and I am getting a "TypeError: act is not a function".

I believe the corresponding code is this: https://github.com/testing-library/svelte-testing-library/blob/40feeb49fd8219a7f9484fd6bdbf2f60fc615cc8/src/svelte5-index.js#L2

Because svelte5.js exports render and cleanup, not act.

Locally, I've imported act from pure.js, but I don't know if that's the intention (otherwise I would have PR'd instead of just opening a ticket).

import { act } from "./pure.js"
import { cleanup } from './svelte5.js'
mcous commented 6 months ago

Intention is to be able to replace @testing-library/svelte with @testing-library/svelte/svelte5. That import line is certainly incorrect

I've opened #346 to fix the issue

mcous commented 5 months ago

@yanick we're good to close this one out, too! I must've forgotten to add the ticket number to the commit message or something

yanick commented 5 months ago

Gotcha. And out it goes!