Hello, i’m trying to configure a unit testing tool; as it runs node, it complains for every module i required.
Things like Promise and Observables must be hidden/shimmed which makes the code a mess. (and defeats the purpose)
Is there any clean way to run tests including those classes?
Hi! Fuse has support for testing built in. Keep in mind that it is quite a new feature that will get more love in upcoming releases We are in the process of pushing out documentation, but here it is in the meanwhile:
A test in UX consists of an element with a ux:Test attribute.
The value of this attribute determines the name of the test.
<Panel ux:Test="MyTest">
</Panel>
Any JavaScript code that throws an Error will make the test fail.
<Panel ux:Test="MyTest">
<JavaScript>
throw new Error("This will always fail");
</JavaScript>
</Panel>
Pure JavaScript tests are also possible using JavaScriptTest:
I want only to test Javascript in an automated manner; the later objective is to have it on CI. I also have that issue on my macbook air not being able to preview; so this is the only way i have to proceed. Anyway, i made a lot of attempts and still failed to make it work.
Does the tag JavaScriptTest must be inside any specific environment?
Hi! That’s too bad, I hope your preview issue gets fixed quickly.
Anyway, I created a little project that contains the basics for JS testing. When running uno test test-test.unoproj, there should be one failing and one passing test.
Thanks! It works, and it kinda works with the debugger also with the additional params --run-local --target=dotnet -DDEBUG_V8; the only problem i had with this is that using webstorm, it does not correctly map the files;
Another thing, but might be my laptop, is that it takes ~17sec to ~200sec(fresh) to build and run tests.
Anyway, as it was a bit slow to make a productive tdd test/code cycle I ended up exploring the apk and manually importing the FuseJS/Observable! Now i can debug and run js tests using node in less than 1 second.