question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New Rule: Use ember test-helper util function in tests instead of native window method

See original GitHub issue

ID: prefer-ember-test-helpers

Overview: We would like to add a lint rule to assist in users writing tests in Ember using @ember/test-helpers to ensure they are using the correct method, in particular with async calls.

A complete list of Window native methods are here: https://developer.mozilla.org/en-US/docs/Web/API/Window#Methods These are the methods in ember-test-helpers (notably the DOM related sections): https://github.com/emberjs/ember-test-helpers/blob/master/API.md

This is the list we’ve identified already that have overlap, please call out others if missing 😃

  • blur
  • find
  • focus

Background: In writing tests I discovered that a focus() call was being made without an import from @ember/test-helpers. This meant that it was actually the native focus() method on window being used, so trying to await did not have the right behavior, nor were there any errors or warnings thrown since it’s a legitimate native method call.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
fierysunsetcommented, Feb 28, 2020

Sounds good! I’ll find some time in the next week to work on it and get back to you all. Thanks for the responses! ❤️

0reactions
bmishcommented, Feb 28, 2020

We can proceed with this issue, I closed #258.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ember-test-helpers/API.md at master - GitHub
Returns Promise<void> resolves when settled. click. Clicks on the specified target. Sends a number of events intending to simulate a "real" user clicking...
Read more >
ember/test - 4.9
registerHelper is used to register a test helper that will be injected when App.injectTestHelpers is called. The helper method will always be called...
Read more >
The Ember.js testing guide, I made for myself - Medium
acceptance tests test the application from a user's point of view by performing the actions like visiting a route, interacting with the rendered...
Read more >
eslint-plugin-ember/README.md - UNPKG
> An ESlint plugin that provides set of rules for Ember Applications based on commonly known good practices. 8. 9, ## ❗️Requirements.
Read more >
eslint-plugin-ember | Yarn - Package Manager
NPM version NPM downloads CI. An ESLint plugin that provides a set of rules for Ember applications based on commonly known good practices....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found