linuxmint/cjs

How to test js files?

Opened this issue · 2 comments

I would like to write unit tests for the radio applet I am maintaining which I find very difficult as it is not possible to use standard testing libraries due to the different runtime environment. I have seen that there are some tests for js files in this repo but I don't understand how to use them. I am even not sure if it is even possible to apply this tests to an applet.

Any help in this regard is much appreciated.

Woah. Sorry for just setting this now and uh.... I would suggest using GJS tests and making similar ones for cinnamon. There are a few files here and there throughout cinnamon for JS tests but i would assume just run the test files with /usr/bin/cjs?

i would assume just run the test files with /usr/bin/cjs?

Yes, but how? I am referring to the tests in /installed-tests/js of this repository. It is not possible to just pick a file and run the file with cjs, e.g. this command:

cjs testGio.js

gives this error:

(cjs:6763): Cjs-CRITICAL **: 11:59:52.738: JS ERROR: ReferenceError: describe is not defined
@testGio.js:15:1

which is not very surprising. I guess I have to somehow call also jasmine.js but I have no idea how. Also maybe I have to do something with the meson.build file? (I never have used meson)