New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESM build #1551
Comments
@matthewp There shouldn't be any need to bring the QUnit object in as a module import. It is meant to bootstrap the HTML page for you and takes care of itself. The test suites should reference Could you explain what problem or advantage you are currently addressing by using QUnit in this way? I'd prefer not to maintain multiple build outputs, but I could consider it or come up with simpler solutions, if I understood the use case better. Thanks! |
Maybe I'm not following but I need to reference the QUnit object to do: QUnit.test('my test').... The advantage to it being available as a module is the same as for any module. |
@matthewp The |
Same problem here. Test modules that require QUnit al import QUnit, and I need to build them before the can be used. |
@Krinkle Yeah maybe I wasn't being clear about my reasoning here. Yes, QUnit works fine as a global via a classic script tag. There's nothing that doesn't work about it. It's just that I would rather my modules explicitly import their dependencies and not rely on external dependency management (having to remember to always include a script tag in the right order on the page). So the reason to have QUnit be a module is the same reason to have any dependency to be a module. |
Same for me: Having explicit imports makes code easier to reason about for me: When I read the tests, I want to know where objects come from. Currently I need to know that QUnit comes as a global when I run my tests in a browser window. |
An ESM build would be nice given that browser support for modules is mature these days.
Currently to use modules when testing with QUnit I do something like this:
local_qunit.js
test.js
Given that qunit is using rollup for the build it should be relatively straight-foward to add a second build output for use with
<script type="module">
so you would be able to do:The text was updated successfully, but these errors were encountered: