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

Clarified how to update tests/test-helper.js when migrating ember-qunit to v5.x #919

Merged
merged 1 commit into from
Dec 7, 2020
Merged

Clarified how to update tests/test-helper.js when migrating ember-qunit to v5.x #919

merged 1 commit into from
Dec 7, 2020

Conversation

ijlee2
Copy link
Contributor

@ijlee2 ijlee2 commented Dec 7, 2020

Description

Currently, the README shows the following code snippet to help with upgrading ember-qunit to v5.x or above:

// tests/test-helper.js
import { setup } from 'qunit-dom';

//...

setup(QUnit.assert);

//...

I encountered the following error because I didn't import QUnit:

Global error: Uncaught ReferenceError: QUnit is not defined at http://localhost:7357/assets/tests.js

In this pull request, I updated the code snippet to show a developer (1) how they are to import QUnit and setup, and (2) in what recommended order they can call setup. I used QUnit DOM's own test helper to decide the recommended order.

@@ -43,16 +43,21 @@ Import and run the `setup` function in your `test-helper.js` file:

```js
// tests/test-helper.js
import * as QUnit from 'qunit';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure if it'd be good to show the default import statements,

import Application from 'my-project-name/app';
import config from 'my-project-name/config/environment';
import { setApplication } from '@ember/test-helpers';
import { start } from 'ember-qunit';

to make it even clearer where we get setApplication, Application, config, and start from.

I can push another commit to add these import statements if you'd like.

Copy link
Collaborator

@Turbo87 Turbo87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, thanks! ❤️

@Turbo87 Turbo87 merged commit c0258cc into mainmatter:master Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants