ptomato / jasmine-gjs

Jasmine for GJS
MIT License
20 stars 8 forks source link

`__init__.js` is not parsed #34

Closed andyholmes closed 4 years ago

andyholmes commented 4 years ago

In a test-suite that adds a path to imports.searchPath with GJS_PATH, __init__.js is not parsed.

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):

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);
  });
});
andyholmes commented 4 years ago

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.