Skip to content

Commit a1ad98c

Browse files
authored
Merge pull request #139 from ember-engines/eslint-plugin-qunit
Introduce `eslint-plugin-qunit` per latest addon blueprint
2 parents 4be0cb2 + cd836ca commit a1ad98c

File tree

9 files changed

+40
-19
lines changed

9 files changed

+40
-19
lines changed

.eslintrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,10 @@ module.exports = {
6969
],
7070
},
7171
},
72+
{
73+
// test files
74+
files: ['tests/**/*-test.{js,ts}'],
75+
extends: ['plugin:qunit/recommended'],
76+
},
7277
],
7378
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"eslint-plugin-ember": "^10.6.0",
5353
"eslint-plugin-node": "^11.1.0",
5454
"eslint-plugin-prettier": "^4.0.0",
55+
"eslint-plugin-qunit": "^7.2.0",
5556
"loader.js": "^4.7.0",
5657
"mocha": "^6.0.2",
5758
"npm-run-all": "^4.1.5",

tests/acceptance/asset-load-test.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,25 @@ module('Acceptance | asset-load', function (hooks) {
3636
const originalColor = originalContainerStyle.color;
3737

3838
let containerText = container.innerText;
39-
assert.equal(containerText, '', 'test container is empty before load');
39+
assert.strictEqual(
40+
containerText,
41+
'',
42+
'test container is empty before load'
43+
);
4044

4145
await visit('/');
4246

43-
assert.equal(currentRouteName(), 'index', 'transitioned ');
47+
assert.strictEqual(currentRouteName(), 'index', 'transitioned ');
4448

4549
const testScriptText = container.querySelector('h2').innerText;
46-
assert.equal(
50+
assert.strictEqual(
4751
testScriptText,
4852
'Test script loaded!',
4953
'test script was executed'
5054
);
5155

5256
const routeText = container.querySelector('h1').innerText;
53-
assert.equal(routeText, 'Welcome!', 'route was loaded correctly');
57+
assert.strictEqual(routeText, 'Welcome!', 'route was loaded correctly');
5458

5559
containerText = container.innerText;
5660
assert.ok(
@@ -88,7 +92,7 @@ module('Acceptance | asset-load', function (hooks) {
8892

8993
await visit('asset-error');
9094

91-
assert.equal(currentRouteName(), 'asset-error', 'transitioned ');
95+
assert.strictEqual(currentRouteName(), 'asset-error', 'transitioned ');
9296

9397
return waitFor(() => !getScript())
9498
.catch((reason) => {

tests/unit/asset-manifest-test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ module('Unit | asset-manifest', function (hooks) {
5858
});
5959

6060
test('throws an error if unable to load the manifest', function (assert) {
61+
assert.expect(1);
62+
6163
delete requirejs.entries['dummy/config/node-asset-manifest'];
6264

6365
const meta = document.querySelector(

tests/unit/errors/asset-load-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module('Unit | Error | asset-load', function (hooks) {
3434
this.asset,
3535
this.originalError
3636
);
37-
assert.equal(
37+
assert.strictEqual(
3838
error.toString(),
3939
'AssetLoadError: The js asset with uri "some-js-file.js" failed to load with the error: Error: some error.'
4040
);
@@ -46,7 +46,7 @@ module('Unit | Error | asset-load', function (hooks) {
4646
this.asset,
4747
this.originalError
4848
);
49-
assert.equal(
49+
assert.strictEqual(
5050
error.retryLoad(),
5151
'Loaded js asset with uri "some-js-file.js".'
5252
);

tests/unit/errors/bundle-load-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module('Unit | Error | bundle-load', function (hooks) {
2222
);
2323
assert.ok(error instanceof Error, 'BundleLoadError inherits Error');
2424
assert.ok(error.stack, 'stack is preserved');
25-
assert.equal(error.bundleName, this.bundleName, 'bundleName is set');
25+
assert.strictEqual(error.bundleName, this.bundleName, 'bundleName is set');
2626
assert.strictEqual(error.errors, this.errors, 'errors is set');
2727
});
2828

@@ -32,7 +32,7 @@ module('Unit | Error | bundle-load', function (hooks) {
3232
this.bundleName,
3333
this.errors
3434
);
35-
assert.equal(
35+
assert.strictEqual(
3636
error.toString(),
3737
'BundleLoadError: The bundle "herp-de-derp" failed to load.'
3838
);
@@ -44,6 +44,6 @@ module('Unit | Error | bundle-load', function (hooks) {
4444
this.bundleName,
4545
this.errors
4646
);
47-
assert.equal(error.retryLoad(), 'Loaded the bundle "herp-de-derp".');
47+
assert.strictEqual(error.retryLoad(), 'Loaded the bundle "herp-de-derp".');
4848
});
4949
});

tests/unit/errors/load-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ module('Unit | Error | load', function () {
99

1010
assert.ok(error instanceof Error, 'LoadError inherits Error');
1111
assert.ok(error.stack, 'stack is preserved');
12-
assert.equal(error.message, message, 'message is set');
12+
assert.strictEqual(error.message, message, 'message is set');
1313
assert.strictEqual(error.loader, loader, 'loader is set');
1414
});
1515

1616
test('toString() - has correct name and message', function (assert) {
1717
const error = new LoadError('herp-de-derp');
18-
assert.equal(error.toString(), 'LoadError: herp-de-derp');
18+
assert.strictEqual(error.toString(), 'LoadError: herp-de-derp');
1919
});
2020

2121
test('retryLoad() - throws an error', function (assert) {

tests/unit/services/asset-loader-test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ module('Unit | Service | asset-loader', function (hooks) {
6060
});
6161

6262
return service.loadBundle('blog').then((bundle) => {
63-
assert.equal(bundle, 'blog');
63+
assert.strictEqual(bundle, 'blog');
6464
});
6565
});
6666

@@ -97,12 +97,12 @@ module('Unit | Service | asset-loader', function (hooks) {
9797
service.defineLoader('fail', () => RSVP.reject('rejected'));
9898

9999
return service.loadBundle('blog').then(shouldNotHappen(assert), (error) => {
100-
assert.equal(
100+
assert.strictEqual(
101101
error.errors.length,
102102
1,
103103
'has an array of the errors causing the load to fail.'
104104
);
105-
assert.equal(
105+
assert.strictEqual(
106106
error.toString(),
107107
'BundleLoadError: The bundle "blog" failed to load.',
108108
'error message contains correct info.'
@@ -258,7 +258,7 @@ module('Unit | Service | asset-loader', function (hooks) {
258258
service.defineLoader('test', () => RSVP.reject('some error'));
259259

260260
return service.loadAsset(asset).then(shouldNotHappen(assert), (error) => {
261-
assert.equal(
261+
assert.strictEqual(
262262
error.toString(),
263263
'AssetLoadError: The test asset with uri "someuri" failed to load with the error: some error.'
264264
);
@@ -383,7 +383,7 @@ module('Unit | Service | asset-loader', function (hooks) {
383383

384384
return service.loadAsset(asset).then(() => {
385385
const newNumScripts = document.querySelectorAll('script').length;
386-
assert.equal(newNumScripts, numScripts);
386+
assert.strictEqual(newNumScripts, numScripts);
387387
});
388388
});
389389

@@ -395,7 +395,7 @@ module('Unit | Service | asset-loader', function (hooks) {
395395

396396
return service.loadAsset(asset).then(() => {
397397
const script = document.querySelector('script[src="/unit-test.js"]');
398-
assert.equal(script.async, false);
398+
assert.false(script.async);
399399
});
400400
});
401401

@@ -445,7 +445,7 @@ module('Unit | Service | asset-loader', function (hooks) {
445445

446446
return service.loadAsset(asset).then(() => {
447447
const newNumLinks = document.querySelectorAll('link').length;
448-
assert.equal(newNumLinks, numLinks);
448+
assert.strictEqual(newNumLinks, numLinks);
449449
});
450450
});
451451

yarn.lock

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7592,6 +7592,14 @@ eslint-plugin-prettier@^4.0.0:
75927592
dependencies:
75937593
prettier-linter-helpers "^1.0.0"
75947594

7595+
eslint-plugin-qunit@^7.2.0:
7596+
version "7.2.0"
7597+
resolved "https://registry.yarnpkg.com/eslint-plugin-qunit/-/eslint-plugin-qunit-7.2.0.tgz#ad00e0007dc0bbd1d59309cc6388238b6a8784a3"
7598+
integrity sha512-ebT6aOpmMj4vchG0hVw9Ukbutk/lgywrc8gc9w9hH2/4WjKqwMlyM7iVwqB7OAXv6gtQMJZuziT0wNjjymAuWA==
7599+
dependencies:
7600+
eslint-utils "^3.0.0"
7601+
requireindex "^1.2.0"
7602+
75957603
[email protected], eslint-scope@^5.1.1:
75967604
version "5.1.1"
75977605
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
@@ -13791,6 +13799,7 @@ terser@^5.7.2:
1379113799

1379213800
"test-generator-plugin@link:./tests/dummy/lib/test-generator-plugin":
1379313801
version "0.0.0"
13802+
uid ""
1379413803

1379513804
testem@^2.14.0:
1379613805
version "2.17.0"

0 commit comments

Comments
 (0)