kolodny / safetest

MIT License
1.38k stars 34 forks source link

Dynamic rendering blocking #16

Closed MartinFerret closed 8 months ago

MartinFerret commented 8 months ago

When I run my tests, I'm able to do it when it's simple, like that :

image

When it involves rendering something, I can't get it working, the page tries to load but doesn't, like that :

image

image

I'm integrating it on a project, in Angular 16.

Is there a specific config to handle this or that causes the crash ?

kolodny commented 8 months ago

Usually this is an issue with the bootstrapping code. Your bootstrapping code should look like this. One of the hidden features of SafeTest is you can add #safetest to the url, reload the page, and the console should display all the test files and associated tests. See here for that working in the example angular app. image

Does that show you all your test files and tests? If not then you probably have something misconfigured in the bootstrapping code.

MartinFerret commented 8 months ago

I do have the same config file, I'm comparing what changes between my config and yours, because in the example file it works fine.

When tests with "render" are running, that very error is displayed in console :

image

jest file :

image

setup safetest file :

image

main.ts :

image

Do you have any idea where doest it come from ?

The only difference entre yours and mine, is that mine added npm install safetest.

kolodny commented 8 months ago

That error is a red herring, it's fixed in https://github.com/kolodny/safetest/commit/f57bb0f479b9d299288ec28b372027eb4b9752b5#diff-81a6613f09b12b04742d8b6ef9524cac4577d91a2440485d0cacace86f489069R60, it just needs to be released.

Everything should work per your config. Can you create a minimal repo that has the issue?

MartinFerret commented 8 months ago

Yes of course,I'll post my github link here by tomorrow so you can have a look at it

MartinFerret commented 8 months ago

Here it is @kolodny , gave you the rights to access it.

https://github.com/MartinFerret/safetest-error-case

npm install npx jest

When the browser opens, check in the console and the error appears, also the navigator, obviously, is blocking trying to figure out a way to execute the tests, but gets stuck.

kolodny commented 8 months ago

OK, I see the issue was that windows was using \ while webpack is expecting /. I published a fix in version 0.1.13. Can you let me know if that fixes the issue?

MartinFerret commented 8 months ago

Thanks a lot, it resolves the issue on windows !