Closed andyholmes closed 4 years ago
In a test-suite that adds a path to imports.searchPath with GJS_PATH, __init__.js is not parsed.
imports.searchPath
GJS_PATH
__init__.js
Example:
/myjs /myjs/__init__.js /myjs/script.js
Where __init__.js does something like:
globalThis.foo = 'bar';
And script.js does something like this (or whatever):
script.js
log(bar);
Both of these will fail:
const MyScript = imports.myjs.script; describe("A suite", function() { it("has __init__.js", function() { expect(imports.myjs.__init__).not.toBe(undefined); }); it("loads __init__.js", function() { expect(bar).not.toBe(undefined); }); });
As discussed in #javascript, the problem was actually import_module_init() in GJS silencing errors in __init__.js, so not a bug for this repo.
import_module_init()
In a test-suite that adds a path to
imports.searchPath
withGJS_PATH
,__init__.js
is not parsed.Example:
Where
__init__.js
does something like:And
script.js
does something like this (or whatever):Both of these will fail: