qwik icon indicating copy to clipboard operation
qwik copied to clipboard

[📖] Add a testing guide section

Open GustavoMelloGit opened this issue 1 year ago • 2 comments

Suggestion

I do not know Qwik well enough to make this page, but it would be really cool if we had a section that explains some things we should know before making some tests. Example: I was having trouble creating a unit test for my component because I kept getting the following error:

QWIK ERROR Code(13): Actual value for useContext(qc-l) can not be found, make sure some ancestor component has set a 
value using useContextProvider(). In the browser make sure that the context was used during SSR so its state was 
serialized. qc-l Error: Code(13): Actual value for useContext(qc-l) can not be found, make sure some ancestor component 
has set a value using useContextProvider(). 
In the browser make sure that the context was used during SSR so its state was serialized.

Some days later, someone on Qwik's Discord server that i should wrap my component with QwikCityMockProvider . It really frustrated me that I could not find the answer on my own.

GustavoMelloGit avatar Jun 17 '24 22:06 GustavoMelloGit

Completely agree. I think a testing page in the guides section of the docs covering how to use the @builder.io/qwik/testing package, how to create a test with Qwik, things like when to use the QwikCityMockProvider, etc.

Is that something you could take a stab at @GustavoMelloGit?

thejackshelton avatar Jun 19 '24 01:06 thejackshelton

@thejackshelton Sadly I am really new at Qwik so i don't know enough to make it

GustavoMelloGit avatar Jun 21 '24 14:06 GustavoMelloGit

Thanks @GustavoMelloGit now the documentation is explaining how to test Qwik components. So I'm closing this issue for now, feel free to re-open it if it's still an issue for you.

gioboa avatar Aug 29 '25 14:08 gioboa