Open Bug 1453816 Opened 7 years ago Updated 2 years ago

Provide a way to test ES modules via xpcshell

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: MattN, Unassigned)

References

(Blocks 1 open bug)

Details

It doesn't seem like there's a way to test an ES module from within an xpcshell-test. Test files aren't considered modules so get "import declarations may only appear at top level of a module" if you use `import`. Using `loadSubScript` on a modules leads to errors about `export` not being allowed outside a module. Example loadSubScript call that I wanted to change to import a module: https://dxr.mozilla.org/mozilla-central/rev/2318adaec61f07eccf66c3f742497aa973b15f2f/toolkit/components/payments/test/unit/test_PaymentsStore.js#4 Bug 1311728 would work but it would be non-standard.
The persons to ask on this topic would be :tcampbell and :kmag.
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.