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-new-qunit-tests`

See original GitHub issue

Proposal

(The name could probably use some tweaking (man, naming is hard 😓 )

Goal of this rule is to enforce usage of the new-style qunit tests: http://rwjblue.com/2017/10/23/ember-qunit-simplication/

It should highlight places where we’re using old style qunit tests, using moduleForComponent or moduleFor. This could come especially handy when converting to new test syntax in bigger teams (where for some reason using codemod is out of the question) and also to enforce uniform usage (since the old style is still working).

Example (taken from RFC):

Component:

//=========
// bad
//=========

import { moduleForComponent, test } from 'ember-qunit';
//...

moduleForComponent('x-foo', {
  integration: true
});

//...

//==========
// good
//==========

import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
//...

module('x-foo', function(hooks) {
  setupRenderingTest(hooks);
  //..
});

Service/Controller/Route:

//==========
// bad
//==========

import { moduleFor, test } from 'ember-qunit';

moduleFor('service:flash', 'Unit | Service | Flash', {
  unit: true
});

//...

//==========
// good
//==========

import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';

module('Unit | Service | Flash', function(hooks) {
  setupTest(hooks);

  //...
});

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bmishcommented, Aug 28, 2020

@Mifrill: We do have an existing rule no-test-module-for. I think that addresses most of what this issue was talking about?

Although it looks like there was a PR for a new rule use-nested-qunit-syntax (https://github.com/ember-cli/eslint-plugin-ember/pull/281 ) that got lost.

1reaction
rwjbluecommented, Nov 8, 2018

This landed and is included in 5.3.0, will be in the recommended set with 6.0.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Proposed Rules - GovInfo
The revised. Common Rule includes provisions intended to strengthen the effectiveness of the human subject protection regulations, and FDA is ...
Read more >
Recently Adopted Rules
Recently Adopted Rules. Adopted and rules are the final rules that must be followed by the regulated community after they take effect. Adopted...
Read more >
Let the Population Collapse | Real Time with Bill Maher (HBO)
New Rule : Let the Population Collapse | Real Time with Bill Maher (HBO). 1.9M views 5 months ago. Real Time with Bill...
Read more >
New Rules - Late in the Evening (Official Video) - YouTube
Listen to "Late in the Evening" everywhere now: http://newrules.lnk.to/liteFollow #NewRules:Instagram: ...
Read more >
New Rule: Apply Precision to the Pandemic | Real Time (HBO)
Subscribe to the Real Time YouTube: http://itsh.bo/10r5A1BBill questions why the same people in medicine who, in private care, ...
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