Skip to content

Commit 35cd64c

Browse files
author
Andrey Fel
committed
Remove traces of linting tests
Long time ago linters were run as tests. And ember-exam was splitting tests into partitions in lint aware style because linting tests are much faster than regular tests. Nowadays we don't run linters as tests and this feature is no longer necessary. Remove it from the code to avoid the confusion of the future generations. The initial driver for this change was a failing test which was complaining on something related to jshint and potentially it was caused by removal of jshint support from ember-cli.
1 parent 2d6150c commit 35cd64c

11 files changed

Lines changed: 28 additions & 165 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ $ ember exam --file-path='/my-application/tests/unit/*.js'
288288
$ ember exam --parallel=<num> --load-balance
289289
```
290290

291-
The `load-balance` option allows you to load balance test files against multiple browsers. It will order the test files by test types, e.g. acceptance | integration | unit | eslint, and load balance the ordered test files between the browsers dynamically rather than statically.
291+
The `load-balance` option allows you to load balance test files against multiple browsers. It will order the test files by test types, e.g. acceptance | integration | unit, and load balance the ordered test files between the browsers dynamically rather than statically.
292292
**Note:** parallel must be used along with load-balance to specify a number of browser(s)
293293

294294
The `load-balance` option was added to version 1.1 to address execution performance when running against a large test suite.

addon-test-support/-private/split-test-modules.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,16 @@ function createGroups(num) {
88
return groups;
99
}
1010

11-
function filterIntoGroups(arr, filter, numGroups) {
12-
const filtered = arr.filter(filter);
11+
function splitIntoGroups(arr, numGroups) {
1312
const groups = createGroups(numGroups);
1413

15-
for (let i = 0; i < filtered.length; i++) {
16-
groups[i % numGroups].push(filtered[i]);
14+
for (let i = 0; i < arr.length; i++) {
15+
groups[i % numGroups].push(arr[i]);
1716
}
1817

1918
return groups;
2019
}
2120

22-
function isLintTest(name) {
23-
return name.match(/\.(jshint|(es)?lint-test)$/);
24-
}
25-
26-
function isNotLintTest(name) {
27-
return !isLintTest(name);
28-
}
29-
3021
/**
3122
* Splits the list of modules into unique subset of modules
3223
* return the subset indexed by the partition
@@ -43,8 +34,7 @@ export default function splitTestModules(modules, split, partitions) {
4334
throw new Error('You must specify a split greater than 0');
4435
}
4536

46-
const lintTestGroups = filterIntoGroups(modules, isLintTest, split);
47-
const otherTestGroups = filterIntoGroups(modules, isNotLintTest, split);
37+
const testGroups = splitIntoGroups(modules, split);
4838
const tests = [];
4939

5040
for (let i = 0; i < partitions.length; i++) {
@@ -67,7 +57,7 @@ export default function splitTestModules(modules, split, partitions) {
6757
}
6858

6959
const group = partition - 1;
70-
tests.push(...lintTestGroups[group], ...otherTestGroups[group]);
60+
tests.push(...testGroups[group]);
7161
}
7262

7363
return tests;

addon-test-support/-private/weight-test-modules.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
const TEST_TYPE_WEIGHT = {
2-
eslint: 1,
32
unit: 10,
43
integration: 20,
54
acceptance: 150,
65
};
7-
const WEIGHT_REGEX = /\/(eslint|unit|integration|acceptance)\//;
6+
const WEIGHT_REGEX = /\/(unit|integration|acceptance)\//;
87
const DEFAULT_WEIGHT = 50;
98

109
/**
1110
* Return the weight for a given module name, a file path to the module
12-
* Ember tests consist of Acceptance, Integration, Unit, and lint tests. In general, acceptance takes
11+
* Ember tests consist of Acceptance, Integration, and Unit tests. In general, acceptance takes
1312
* longest time to execute, followed by integration and unit.
1413
* The weight assigned to a module corresponds to its test type execution speed, with slowest being the highest in weight.
1514
* If the test type is not identifiable from the modulePath, weight default to 50 (ordered after acceptance, but before integration)

lib/commands/exam.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = TestCommand.extend({
4141
type: Boolean,
4242
default: false,
4343
description:
44-
'Load balance test modules. Test modules will be sorted by weight from slowest (acceptance) to fastest (eslint).',
44+
'Load balance test modules. Test modules will be sorted by weight from slowest (acceptance) to fastest (unit).',
4545
},
4646
{
4747
name: 'preserve-test-name',

tests/dummy/app/templates/docs/load-balancing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ember exam --parallel=<num> --load-balance
55
```
66

7-
The `load-balance` option allows you to load balance test files against multiple browsers. It will order the test files by test types, e.g. acceptance | integration | unit | eslint, and load balance the ordered test files between the browsers dynamically rather than statically.
7+
The `load-balance` option allows you to load balance test files against multiple browsers. It will order the test files by test types, e.g. acceptance | integration | unit, and load balance the ordered test files between the browsers dynamically rather than statically.
88
**Note:** parallel must be used along with load-balance to specify a number of browser(s)
99

1010
The `load-balance` option was added to version 1.1 to address execution performance when running against a large test suite.

tests/unit/mocha/filter-test-modules-test.js

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,16 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) {
3939
beforeEach(() => {
4040
modules = [
4141
'foo-test',
42-
'foo-test.jshint',
4342
'bar-test',
44-
'bar-test.jshint',
4543
];
4644
});
4745

4846
afterEach(() => {
4947
modules = [];
5048
});
5149

52-
it('should return a list of jshint tests', () => {
53-
expect(filterTestModules(modules, 'jshint')).to.deep.equal([
54-
'foo-test.jshint',
55-
'bar-test.jshint',
56-
]);
50+
it('should return a list of filtered tests', () => {
51+
expect(filterTestModules(modules, 'foo')).to.deep.equal(['foo-test']);
5752
});
5853

5954
it('should return an empty list when there is no match', () => {
@@ -63,33 +58,22 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) {
6358
});
6459

6560
it('should return a list of tests matched with a regular expression', () => {
66-
expect(filterTestModules(modules, '/jshint/')).to.deep.equal([
67-
'foo-test.jshint',
68-
'bar-test.jshint',
69-
]);
61+
expect(filterTestModules(modules, '/foo/')).to.deep.equal(['foo-test']);
7062
});
7163

72-
it('should return a list of tests matched with a regular expression that excluses jshint', () => {
73-
expect(filterTestModules(modules, '!/jshint/')).to.deep.equal([
74-
'foo-test',
75-
'bar-test',
76-
]);
64+
it('should return a list of tests matched with a regular expression that excluses foo', () => {
65+
expect(filterTestModules(modules, '!/foo/')).to.deep.equal(['bar-test']);
7766
});
7867

7968
it('should return a list of tests matches with a list of string options', () => {
8069
expect(filterTestModules(modules, 'foo, bar')).to.deep.equal([
8170
'foo-test',
82-
'foo-test.jshint',
8371
'bar-test',
84-
'bar-test.jshint',
8572
]);
8673
});
8774

8875
it('should return a list of unique tests matches when options are repeated', () => {
89-
expect(filterTestModules(modules, 'foo, foo')).to.deep.equal([
90-
'foo-test',
91-
'foo-test.jshint',
92-
]);
76+
expect(filterTestModules(modules, 'foo, foo')).to.deep.equal(['foo-test']);
9377
});
9478
});
9579

tests/unit/mocha/test-loader-test.js

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,9 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) {
1919

2020
window.requirejs.entries = {
2121
'test-1-test': true,
22-
'test-1-test.jshint': true,
2322
'test-2-test': true,
24-
'test-2-test.jshint': true,
2523
'test-3-test': true,
26-
'test-3-test.jshint': true,
2724
'test-4-test': true,
28-
'test-4-test.jshint': true,
2925
};
3026
this.originalURLParams = EmberExamTestLoader._urlParams;
3127
});
@@ -39,10 +35,6 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) {
3935
testLoader.loadModules();
4036

4137
expect(this.requiredModules).to.deep.equal([
42-
'test-1-test.jshint',
43-
'test-2-test.jshint',
44-
'test-3-test.jshint',
45-
'test-4-test.jshint',
4638
'test-1-test',
4739
'test-2-test',
4840
'test-3-test',
@@ -58,7 +50,6 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) {
5850
testLoader.loadModules();
5951

6052
expect(this.requiredModules).to.deep.equal([
61-
'test-3-test.jshint',
6253
'test-3-test',
6354
]);
6455
});
@@ -71,9 +62,7 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) {
7162
testLoader.loadModules();
7263

7364
expect(this.requiredModules).to.deep.equal([
74-
'test-1-test.jshint',
7565
'test-1-test',
76-
'test-3-test.jshint',
7766
'test-3-test',
7867
]);
7968
});
@@ -86,7 +75,6 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) {
8675
testLoader.loadModules();
8776

8877
expect(this.requiredModules).to.deep.equal([
89-
'test-1-test.jshint',
9078
'test-1-test',
9179
]);
9280
});
@@ -99,7 +87,6 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) {
9987
testLoader.loadModules();
10088

10189
expect(this.requiredModules).to.deep.equal([
102-
'test-3-test.jshint',
10390
'test-3-test',
10491
]);
10592
});
@@ -178,38 +165,6 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) {
178165
}).to.throw(/You must specify partitions numbered greater than 0/);
179166
});
180167

181-
it('load works without lint tests', function () {
182-
const testLoader = new EmberExamTestLoader(
183-
this.testem,
184-
new Map().set('nolint', true).set('partition', 4).set('split', 4)
185-
);
186-
testLoader.loadModules();
187-
188-
// ember-cli-mocha doesn't support disabling linting by url param
189-
expect(this.requiredModules).to.deep.equal([
190-
'test-4-test.jshint',
191-
'test-4-test',
192-
]);
193-
});
194-
195-
it('load works without non-lint tests', function () {
196-
const testLoader = new EmberExamTestLoader(
197-
this.testem,
198-
new Map().set('partition', 4).set('split', 4)
199-
);
200-
201-
window.requirejs.entries = {
202-
'test-1-test.jshint': true,
203-
'test-2-test.jshint': true,
204-
'test-3-test.jshint': true,
205-
'test-4-test.jshint': true,
206-
};
207-
208-
testLoader.loadModules();
209-
210-
expect(this.requiredModules).to.deep.equal(['test-4-test.jshint']);
211-
});
212-
213168
it('load works with a double-digit single partition', function () {
214169
const testLoader = new EmberExamTestLoader(
215170
this.testem,

tests/unit/mocha/weight-test-modules-test.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) {
1212
describe('Unit | Mocha | weight-test-modules', () => {
1313
it('should sort a list of file paths by weight', function () {
1414
const listOfModules = [
15-
'/eslint/test-1-test',
1615
'/acceptance/test-1-test',
1716
'/unit/test-1-test',
1817
'/integration/test-1-test',
@@ -24,22 +23,19 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) {
2423
'test-1-test',
2524
'/integration/test-1-test',
2625
'/unit/test-1-test',
27-
'/eslint/test-1-test',
2826
]);
2927
});
3028

3129
it('should sort a list of file paths by weight and alphbetical order', function () {
3230
const listOfModules = [
3331
'test-b-test',
3432
'test-a-test',
35-
'/eslint/test-b-test',
3633
'/integration/test-b-test',
3734
'/integration/test-a-test',
3835
'/unit/test-b-test',
3936
'/acceptance/test-b-test',
4037
'/acceptance/test-a-test',
4138
'/unit/test-a-test',
42-
'/eslint/test-a-test',
4339
];
4440

4541
expect(weightTestModules(listOfModules)).to.deep.equal([
@@ -51,8 +47,6 @@ if (macroCondition(dependencySatisfies('ember-mocha', '*'))) {
5147
'/integration/test-b-test',
5248
'/unit/test-a-test',
5349
'/unit/test-b-test',
54-
'/eslint/test-a-test',
55-
'/eslint/test-b-test',
5650
]);
5751
});
5852
});

tests/unit/qunit/filter-test-modules-test.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,18 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) {
4242
hooks.beforeEach(function () {
4343
this.modules = [
4444
'foo-test',
45-
'foo-test.jshint',
4645
'bar-test',
47-
'bar-test.jshint',
4846
];
4947
});
5048

5149
hooks.afterEach(function () {
5250
this.modules = [];
5351
});
5452

55-
test('should return a list of jshint tests', function (assert) {
53+
test('should return a list of filtered tests', function (assert) {
5654
assert.deepEqual(
57-
['foo-test.jshint', 'bar-test.jshint'],
58-
filterTestModules(this.modules, 'jshint')
55+
['foo-test'],
56+
filterTestModules(this.modules, 'foo')
5957
);
6058
});
6159

@@ -68,28 +66,28 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) {
6866

6967
test('should return a list of tests matched with a regular expression', function (assert) {
7068
assert.deepEqual(
71-
['foo-test.jshint', 'bar-test.jshint'],
72-
filterTestModules(this.modules, '/jshint/')
69+
['foo-test'],
70+
filterTestModules(this.modules, '/foo/')
7371
);
7472
});
7573

76-
test('should return a list of tests matched with a regular expression that excluse jshint', function (assert) {
74+
test('should return a list of tests matched with a regular expression that excluse foo', function (assert) {
7775
assert.deepEqual(
78-
['foo-test', 'bar-test'],
79-
filterTestModules(this.modules, '!/jshint/')
76+
['bar-test'],
77+
filterTestModules(this.modules, '!/foo/')
8078
);
8179
});
8280

8381
test('should return a list of tests matches with a list of string options', function (assert) {
8482
assert.deepEqual(
85-
['foo-test', 'foo-test.jshint', 'bar-test', 'bar-test.jshint'],
83+
['foo-test', 'bar-test'],
8684
filterTestModules(this.modules, 'foo, bar')
8785
);
8886
});
8987

9088
test('should return a list of unique tests matches when options are repeated', function (assert) {
9189
assert.deepEqual(
92-
['foo-test', 'foo-test.jshint'],
90+
['foo-test'],
9391
filterTestModules(this.modules, 'foo, foo')
9492
);
9593
});

0 commit comments

Comments
 (0)