ankushg
09/22/2021, 8:04 PMjsTest
sourceset which would basically do something ugly like:
js("""
var assert = require('assert');
var moduleUnderTest = require('myGroup-myModule');
assert(moduleUnderTest.method("parameter") == expectedResponse);
""")
While a little janky, this kind of test let us verify that things like JsName were added where expected and that we didn't accidentally break the public API for our JS consumers.
Now, under JS IR, the require
for my module is failing, because there's no JS file in the expected path. There is a package.json though.
Does anyone know how to get the module import working again under IR?
I'd also be happy to replace this with a JS file (instead of using js()
) that actually uses the final JS artifacts if anyone has an example of a project that does that!
EDIT: it looks like I can remove the require(…)
and get some stuff working, but not everything...Big Chungus
09/22/2021, 8:58 PMankushg
09/22/2021, 8:59 PMrequire
for, where it's complaining that com is not defined
(the object I'm trying to call is in <http://com.org|com.org>.package.MyObject
)
In others though, it works fine
Hopefully I can figure that out…Big Chungus
09/22/2021, 9:25 PMBig Chungus
09/22/2021, 9:26 PMBig Chungus
09/22/2021, 9:29 PMBig Chungus
09/22/2021, 9:43 PMankushg
09/22/2021, 9:55 PMankushg
09/22/2021, 10:19 PMjs(…)
block does work, but the goal of the test cases is to make sure that the namespaces all line up with what's expected, so I'd prefer not to do it that wayankushg
09/22/2021, 10:20 PM_<http://.com.org|.com.org>.package.MyObject
does work, but I'm not sure where the _
is coming from and when/why it's needed.. It doesn't look like it's needed in our actual JS project that consumes the kotlin JS artifacts
Right now, I'm trying to just replace all my var moduleUnderTest = require(…);
with var moduleUnderTest = _;
to see if that fixes thingsankushg
10/06/2021, 6:41 PMvar myModule = require("my-module-name")
with var myModule = _