Skip to content

Commit fdbff8c

Browse files
author
Andrey Fel
committed
Drop mocha support
ember-mocha is not compatible with ember@5 and its support is dropped, so, we can remove mocha support from ember-exam now. @embroider/macros is not needed anymore as we can use static imports now everywhere. qunit and ember-qunit are required peer dependencies now. Normalize test modules to use the same syntax: tests are defined in the scope of module, use non-arrow functions in modules and tests definitions. Normalize `ember-qunit` name everywhere in the docs.
1 parent 955d71d commit fdbff8c

42 files changed

Lines changed: 402 additions & 1402 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ module.exports = {
5959
},
6060
env: {
6161
node: true,
62-
mocha: true,
6362
},
6463
rules: {
6564
'ember/no-test-support-import': 'off',

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,8 @@ jobs:
4444
fail-fast: false
4545
matrix:
4646
ember-try-scenario:
47-
- ember-default-with-mocha
4847
- embroider-safe
49-
- embroider-safe-with-mocha
5048
- embroider-optimized
51-
- embroider-optimized-with-mocha
5249
- ember-lts-4.8
5350
- ember-lts-4.12
5451
- ember-release

README.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Code Climate](https://codeclimate.com/github/trentmwillis/ember-exam/badges/gpa.svg)](https://codeclimate.com/github/trentmwillis/ember-exam)
66
[![Node Test Coverage](https://codeclimate.com/github/trentmwillis/ember-exam/badges/coverage.svg)](https://codeclimate.com/github/trentmwillis/ember-exam/coverage)
77

8-
Ember Exam is an addon to allow you more control over how you run your tests when used in conjunction with [Ember QUnit](https://github.com/emberjs/ember-qunit) or [Ember Mocha](https://github.com/emberjs/ember-mocha). It provides the ability to randomize, split, parallelize, and load-balance your test suite by adding a more robust CLI command.
8+
Ember Exam is an addon to allow you more control over how you run your tests when used in conjunction with [ember-qunit](https://github.com/emberjs/ember-qunit). It provides the ability to randomize, split, parallelize, and load-balance your test suite by adding a more robust CLI command.
99

1010
It started as a way to help reduce flaky tests and encourage healthy test driven development. It's like [Head & Shoulders](http://www.headandshoulders.com/) for your tests!
1111

@@ -70,13 +70,13 @@ $ ember exam --load-balance --parallel --server
7070

7171
The idea is that you can replace `ember test` with `ember exam` and never look back.
7272

73-
To get the unique features of Ember Exam (described in-depth below), you will need to **replace** the use of `start()` from `Ember-Qunit` or `Ember-Mocha` in `test-helper.js` with `start()` from `ember-exam`:
73+
To get the unique features of Ember Exam (described in-depth below), you will need to **replace** the use of `start()` from `ember-qunit` in `test-helper.js` with `start()` from `ember-exam`:
7474

7575
```js
7676
// test-helper.js
7777
import start from 'ember-exam/test-support/start';
7878

79-
// Options passed to `start` will be passed-through to ember-qunit or ember-mocha
79+
// Options passed to `start` will be passed-through to ember-qunit
8080
start();
8181
```
8282

@@ -121,7 +121,7 @@ ember exam --split=2 --random
121121
Randomizing tests with seed: hwr74nkk55vzpvi
122122
```
123123

124-
_Note: You must be using QUnit version `1.23.0` or greater for this feature to work properly. This feature is not currently supported by Mocha._
124+
_Note: You must be using QUnit version `1.23.0` or greater for this feature to work properly.
125125

126126
#### Randomization Iterator
127127

@@ -145,8 +145,6 @@ $ ember exam:iterate <num> --options <options>
145145

146146
The `options` should be a string matching what you would use via the CLI.
147147

148-
_Note: This feature is not currently supported by Mocha._
149-
150148
### Generating Module Metadata File For Test Execution
151149

152150
```bash
@@ -195,8 +193,6 @@ and it looks something like below:
195193
]
196194
```
197195

198-
_Note: This feature is not currently supported by Mocha._
199-
200196

201197
### Splitting
202198

@@ -216,7 +212,7 @@ The `partition` option allows you to specify which test group to run after using
216212
$ ember exam --split=4 --partition=1 --partition=2
217213
```
218214

219-
_Note: Ember Exam splits tests by modifying the Ember-QUnit/Ember-Mocha's `TestLoader` to bucket each test file into a partition, where each partition has an even number of test files. This makes it possible to have unbalanced partitions. To run your tests with balanced partitions, consider using `--load-balance`. For more info, see [_Test Load Balancing_](#test-load-balancing).
215+
_Note: Ember Exam splits tests by modifying the ember-qunit's `TestLoader` to bucket each test file into a partition, where each partition has an even number of test files. This makes it possible to have unbalanced partitions. To run your tests with balanced partitions, consider using `--load-balance`. For more info, see [_Test Load Balancing_](#test-load-balancing).
220216

221217
#### Split Test Parallelization
222218

@@ -325,7 +321,6 @@ ok 3 Chrome 66.0 - Exam Partition 1 - browser Id 3 - some the other test
325321
2. You must be using `ember-cli` version 3.2.0 or greater for load balancing and test failure reproduction features to work properly.
326322
3. You must be using `ember-qunit` version 4.1.1 or greater for this feature to work properly.
327323
4. You must be using `qunit` version 2.13.0 or greater for this feature to work properly.
328-
5. This feature is not currently supported by Mocha.
329324

330325
##### Test Failure Reproduction
331326

@@ -380,7 +375,6 @@ $ ember exam --replay-execution=test-execution-000000.json
380375
1. You must be using `ember-cli` version 3.2.0 or greater for load-balnce and test failure reproduction features to work properly.
381376
2. You must be using `ember-qunit` version 4.1.1 or greater for this feature to work properly.
382377
3. You must be using `qunit` version 2.8.0 or greater for this feature to work properly.
383-
4. This feature is not currently supported by Mocha.
384378

385379
#### Preserve Test Name
386380

addon-test-support/-private/ember-exam-mocha-test-loader.js

Lines changed: 0 additions & 87 deletions
This file was deleted.

addon-test-support/-private/ember-exam-qunit-test-loader.js renamed to addon-test-support/-private/ember-exam-test-loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import QUnit from 'qunit';
1313
* @class EmberExamQUnitTestLoader
1414
* @extends {TestLoader}
1515
*/
16-
export default class EmberExamQUnitTestLoader extends TestLoader {
16+
export default class EmberExamTestLoader extends TestLoader {
1717
constructor(testem, urlParams, qunit = QUnit) {
1818
super();
1919
this._testModules = [];

addon-test-support/-private/get-test-loader.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

addon-test-support/load.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import EmberExamTestLoader from './-private/ember-exam-test-loader';
12
import { patchTestemOutput } from './-private/patch-testem-output';
2-
import getTestLoader from './-private/get-test-loader';
33

44
let loaded = false;
55

@@ -17,7 +17,7 @@ export default function loadEmberExam() {
1717
}
1818

1919
loaded = true;
20-
const EmberExamTestLoader = getTestLoader();
20+
2121
const testLoader = new EmberExamTestLoader(window.Testem);
2222

2323
if (window.Testem) {

addon-test-support/start.js

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import loadEmberExam from 'ember-exam/test-support/load';
2-
import {
3-
dependencySatisfies,
4-
macroCondition,
5-
importSync,
6-
} from '@embroider/macros';
2+
import { start as qunitStart } from 'ember-qunit';
73

84
/**
9-
* Equivalent to ember-qunit or ember-mocha's loadTest() except this does not create a new TestLoader instance
5+
* Equivalent to ember-qunit's loadTest() except this does not create a new TestLoader instance
106
*
117
* @function loadTests
128
* @param {*} testLoader
@@ -23,7 +19,7 @@ function loadTests(testLoader) {
2319

2420
/**
2521
* Ember-exam's own start function to set up EmberExamTestLoader, load tests and calls start() from
26-
* ember-qunit or ember-mocha
22+
* ember-qunit
2723
*
2824
* @function start
2925
* @param {*} qunitOptions
@@ -34,15 +30,5 @@ export default function start(qunitOptions) {
3430

3531
const testLoader = loadEmberExam();
3632
loadTests(testLoader);
37-
38-
let emberTestFramework;
39-
if (macroCondition(dependencySatisfies('ember-qunit', '*'))) {
40-
emberTestFramework = importSync('ember-qunit');
41-
} else if (macroCondition(dependencySatisfies('ember-mocha', '*'))) {
42-
emberTestFramework = importSync('ember-mocha');
43-
}
44-
45-
if (emberTestFramework.start) {
46-
emberTestFramework.start(modifiedOptions);
47-
}
33+
qunitStart(modifiedOptions);
4834
}

bin/install-test-framework.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

ember-cli-build.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,5 @@ module.exports = function (defaults) {
1010
});
1111

1212
const { maybeEmbroider } = require('@embroider/test-setup');
13-
return maybeEmbroider(app, {
14-
packagerOptions: {
15-
webpackConfig: {
16-
externals: {
17-
mocha: 'mocha',
18-
},
19-
},
20-
},
21-
});
13+
return maybeEmbroider(app, {});
2214
};

0 commit comments

Comments
 (0)