Skip to content
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

fix(build): ember-auto-import@2 compatibility #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions vendor/ember-qunit-assert-helpers-loader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
/* globals require */

// Loading the file here will install the asserts onto `QUnit.Assert` class.
require('ember-qunit-assert-helpers/test-support/install-qunit-asserts');
// This file is appended to `test-support.js`.
// It automatically requires the `install-qunit-asserts` entrypoint module to
// install the assertions onto `Qunit`.
//
// With `ember-auto-import@1` all vanilla JS dependencies, like `qunit`, are
// eagerly bundled into either `vendor.js` or `test-support.js`.
// Therefore they are available, when this module is evaluated.
//
// With `ember-auto-import@2` these dependencies are placed into extra
// `*.chunk.js` files instead. These files are loaded _after_ `vendor.js` and
// `test-support.js`. Therefore they are not available, when this module is
// evaluated.
// To fix this, we delay the evaluation of the entry point until the
// `DOMContentLoaded` event occurs, by which all `<script>` tags will have been
// loaded.
//
// This is not an ideal solution, but only a temporary fix with minimal changes
// to make this addon work with `ember-auto-import@2` host apps.
document.addEventListener('DOMContentLoaded', () => {
require('ember-qunit-assert-helpers/test-support/install-qunit-asserts');
});