ember-exam 7.0.0 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/lib/commands/exam.js +17 -19
  3. package/lib/utils/test-page-helper.js +2 -1
  4. package/lib/utils/testem-events.js +10 -2
  5. package/package.json +3 -2
  6. package/.codeclimate.yml +0 -20
  7. package/.github/dependabot.yml +0 -40
  8. package/.github/workflows/ci.yml +0 -68
  9. package/.github/workflows/release.yml +0 -25
  10. package/.prettierignore +0 -25
  11. package/.prettierrc.js +0 -5
  12. package/CONTRIBUTING.md +0 -27
  13. package/RELEASE.md +0 -60
  14. package/addon-test-support/.eslintrc +0 -6
  15. package/bin/install-test-framework.sh +0 -5
  16. package/config/deploy.js +0 -29
  17. package/config/environment.js +0 -5
  18. package/lib/.eslintrc +0 -5
  19. package/node-tests/.eslintrc +0 -8
  20. package/node-tests/acceptance/exam-iterate-test.js +0 -177
  21. package/node-tests/acceptance/exam-test.js +0 -622
  22. package/node-tests/fixtures/browser-exit.js +0 -12
  23. package/node-tests/fixtures/failure.js +0 -1
  24. package/node-tests/fixtures/test-helper-with-load.js +0 -23
  25. package/node-tests/unit/commands/exam-test.js +0 -180
  26. package/node-tests/unit/lint-test.js +0 -5
  27. package/node-tests/unit/utils/config-reader-test.js +0 -68
  28. package/node-tests/unit/utils/execution-state-manager-test.js +0 -169
  29. package/node-tests/unit/utils/query-helper-test.js +0 -58
  30. package/node-tests/unit/utils/test-page-helper-test.js +0 -341
  31. package/node-tests/unit/utils/testem-events-test.js +0 -511
  32. package/node-tests/unit/utils/tests-options-validator-test.js +0 -418
  33. package/testem.multiple-test-page.js +0 -19
  34. package/testem.no-test-page.js +0 -15
  35. package/testem.simple-test-page.js +0 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## v7.0.1 (2021-11-02)
4
+ #### :bug: Bug Fix
5
+ * [#760](https://github.com/ember-cli/ember-exam/pull/760) Wait for all browser to completet beforer cleaning up StateManager([@step2yeung](https://github.com/step2yeung))
6
+ * [#750](https://github.com/ember-cli/ember-exam/pull/750) Ember exam failing when browser ID not found, return 0([@step2yeung](https://github.com/step2yeung))
7
+
8
+ #### :house: Internal
9
+ * [#748](https://github.com/ember-cli/ember-exam/pull/748) Add eslint-plugin-qunit per latest addon blueprint internal ([@SergeAstapov](https://github.com/SergeAstapov))
10
+ * [#744](https://github.com/ember-cli/ember-exam/pull/744) Update npmignore file internal([@Turbo87](https://github.com/Turbo87))
11
+ #### Committers: 4
12
+
13
+ - Sergey Astapov ([@SergeAstapov](https://github.com/SergeAstapov))
14
+ - Tobias Bieniek ([@Turbo87](https://github.com/Turbo87))
15
+ - Stephen Yeung ([@step2yeung](https://github.com/step2yeung))
16
+
3
17
  ## v7.0.0 (2021-10-22)
4
18
 
5
19
  #### :boom: Breaking Change
@@ -292,26 +292,24 @@ module.exports = TestCommand.extend({
292
292
  const browserExitHandler = function (failed = false) {
293
293
  const launcherId = this.launcher.id;
294
294
  if (!failed && commands.get('loadBalance')) {
295
- try {
296
- const browserId = getBrowserId(this.launcher);
297
- log.info(
298
- `Browser ${browserId} exiting. [ # of modules in current module queue ${
299
- testemEvents.stateManager.getTestModuleQueue().length
300
- } ]`
301
- );
302
- } catch (err) {
303
- const moduleQueueMessage =
304
- testemEvents.stateManager.getTestModuleQueue() === null
305
- ? 'testModuleQueue is not set.'
306
- : `[ # of modules in current module queue ${
307
- testemEvents.stateManager.getTestModuleQueue().length
308
- } ]`;
309
-
310
- if (typeof err === 'object' && err !== null) {
311
- err.message = `${err.message} \n ${moduleQueueMessage}`;
312
- ui.writeLine(err.message);
295
+ const browserId = getBrowserId(this.launcher);
296
+ log.info(
297
+ `Browser ${browserId} exiting. [ # of modules in current module queue ${
298
+ testemEvents.stateManager.getTestModuleQueue().length
299
+ } ]`
300
+ );
301
+ // if getBrowserId cannot get the browserId
302
+ // but the test queue is not empty, report the number of test modules left in the queue
303
+ // otherwise, fail because testModuleQueue was not set
304
+ if (browserId === 0) {
305
+ if (testemEvents.stateManager.getTestModuleQueue() !== null) {
306
+ ui.writeLine(
307
+ `[ # of modules in current module queue ${
308
+ testemEvents.stateManager.getTestModuleQueue().length
309
+ } ]`
310
+ );
313
311
  } else {
314
- throw new Error(moduleQueueMessage);
312
+ throw new Error('testModuleQueue is not set.');
315
313
  }
316
314
  }
317
315
  }
@@ -137,8 +137,9 @@ function getBrowserId(launcher) {
137
137
  const errMsg = `${err.message} \n${
138
138
  err.stack
139
139
  } \nLauncher Settings: ${JSON.stringify(launcher.settings, null, 2)}`;
140
- throw new Error(errMsg);
140
+ console.warn(errMsg);
141
141
  }
142
+ return 0;
142
143
  }
143
144
 
144
145
  /**
@@ -224,7 +224,8 @@ class TestemEvents {
224
224
  let browsersCompleted = false;
225
225
 
226
226
  this.stateManager.incrementCompletedBrowsers(launcherId);
227
- if (this.stateManager.getCompletedBrowser() === browsersStarted.size) {
227
+ const completedBrowser = this.stateManager.getCompletedBrowser();
228
+ if (completedBrowser === browsersStarted.size) {
228
229
  if (commands.get('writeModuleMetadataFile')) {
229
230
  const moduleDetailFileName = path.join(
230
231
  this.root,
@@ -260,9 +261,16 @@ class TestemEvents {
260
261
  }
261
262
 
262
263
  ui.writeLine(
263
- `Out of requested ${browserCount} browser(s), ${browsersStarted.size} browser(s) has launched.`
264
+ `Out of requested ${browserCount} browser(s), ${browsersStarted.size} browser(s) was launched & completed.`
264
265
  );
265
266
 
267
+ if (browserCount !== browsersStarted.size) {
268
+ ui.writeLine('Waiting for remaining browsers to exited.');
269
+ }
270
+ }
271
+
272
+ if (completedBrowser === browserCount) {
273
+ ui.writeLine('All browsers to exited.');
266
274
  // --server mode allows rerun of tests by refreshing the browser
267
275
  // replayExecutionMap should be reused so the test-execution json
268
276
  // does not need to be reread
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-exam",
3
- "version": "7.0.0",
3
+ "version": "7.0.1",
4
4
  "description": "Run your tests with randomization, splitting, and parallelization for beautiful tests.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -84,11 +84,12 @@
84
84
  "eslint-plugin-ember": "^8.9.1",
85
85
  "eslint-plugin-node": "^11.1.0",
86
86
  "eslint-plugin-prettier": "^4.0.0",
87
+ "eslint-plugin-qunit": "^6.2.0",
87
88
  "fixturify": "^1.2.0",
88
89
  "istanbul": "^0.4.3",
89
90
  "loader.js": "^4.7.0",
90
91
  "lodash.mergewith": "^4.6.2",
91
- "mocha": "^8.4.0",
92
+ "mocha": "^9.1.3",
92
93
  "mocha-eslint": "^6.0.0",
93
94
  "npm-run-all": "^4.1.5",
94
95
  "nyc": "^15.1.0",
package/.codeclimate.yml DELETED
@@ -1,20 +0,0 @@
1
- ---
2
- engines:
3
- duplication:
4
- enabled: true
5
- config:
6
- languages:
7
- javascript:
8
- mass_threshold: 50
9
-
10
- eslint:
11
- enabled: true
12
- fixme:
13
- enabled: true
14
- ratings:
15
- paths:
16
- - "**.js"
17
- exclude_paths:
18
- - config/
19
- - tests/
20
- - vendor/
@@ -1,40 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: npm
4
- directory: "/"
5
- schedule:
6
- interval: monthly
7
- time: "03:00"
8
- open-pull-requests-limit: 10
9
- versioning-strategy: increase
10
- ignore:
11
- - dependency-name: ember-cli-babel
12
- versions:
13
- - 7.23.1
14
- - dependency-name: eslint
15
- versions:
16
- - 7.16.0
17
- - 7.19.0
18
- - dependency-name: ember-source
19
- versions:
20
- - 3.24.0
21
- - 3.24.1
22
- - dependency-name: ember-cli
23
- versions:
24
- - 3.23.0
25
- - 3.24.0
26
- - dependency-name: sinon
27
- versions:
28
- - 9.2.2
29
- - dependency-name: eslint-plugin-ember
30
- versions:
31
- - 10.1.1
32
- - dependency-name: ini
33
- versions:
34
- - 1.3.7
35
- - dependency-name: mocha
36
- versions:
37
- - 8.2.1
38
- - dependency-name: elliptic
39
- versions:
40
- - 6.5.3
@@ -1,68 +0,0 @@
1
- name: CI Build
2
-
3
- on:
4
- push:
5
- branches: [ master, 'v*' ]
6
- pull_request:
7
- branches: [ master ]
8
-
9
-
10
- jobs:
11
- test:
12
- name: Tests
13
- runs-on: ubuntu-latest
14
-
15
- steps:
16
- - uses: actions/checkout@v2
17
- - uses: volta-cli/action@v1
18
- - run: yarn install --frozen-lockfile
19
- - run: yarn lint
20
- - run: yarn test:ember
21
-
22
- floating-dependencies:
23
- name: "Floating Dependencies"
24
- runs-on: ubuntu-latest
25
-
26
- steps:
27
- - uses: actions/checkout@v2
28
- - uses: volta-cli/action@v1
29
- - run: yarn install --no-lockfile
30
- - run: yarn test:ember
31
-
32
- try-scenarios:
33
- name: "Try: ${{ matrix.ember-try-scenario }}"
34
-
35
- runs-on: ubuntu-latest
36
-
37
- needs: test
38
-
39
- strategy:
40
- fail-fast: false
41
- matrix:
42
- ember-try-scenario:
43
- - ember-default-with-jquery
44
- - ember-default-with-mocha
45
- - ember-classic
46
- - embroider-safe
47
- - embroider-safe-with-mocha
48
- - embroider-optimized
49
- - embroider-optimized-with-mocha
50
- - ember-lts-3.24
51
- - ember-lts-3.20
52
- - ember-lts-3.16
53
- - ember-lts-3.12
54
- - ember-release
55
- # temporarily disabled until we've fixed support for Ember.js v4
56
- # - ember-beta
57
- # - ember-canary
58
- - ember-qunit-4
59
-
60
- steps:
61
- - uses: actions/checkout@v2
62
- - uses: volta-cli/action@v1
63
- with:
64
- node-version: 12.x
65
- - name: install dependencies
66
- run: yarn install --frozen-lockfile
67
- - name: test
68
- run: node_modules/.bin/ember try:one ${{ matrix.ember-try-scenario }} --skip-cleanup
@@ -1,25 +0,0 @@
1
- name: Release
2
-
3
- on:
4
- push:
5
- tags:
6
- - 'v*'
7
-
8
- jobs:
9
- release:
10
- name: release
11
- runs-on: ubuntu-latest
12
-
13
- steps:
14
- - uses: actions/checkout@v2
15
- - uses: actions/setup-node@v2
16
- with:
17
- node-version: 14
18
- registry-url: 'https://registry.npmjs.org'
19
-
20
- - run: yarn install
21
- - run: yarn auto-dist-tag --write
22
-
23
- - run: npm publish
24
- env:
25
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/.prettierignore DELETED
@@ -1,25 +0,0 @@
1
- # unconventional js
2
- /blueprints/*/files/
3
- /vendor/
4
-
5
- # compiled output
6
- /dist/
7
- /tmp/
8
-
9
- # dependencies
10
- /bower_components/
11
- /node_modules/
12
-
13
- # misc
14
- /coverage/
15
- !.*
16
- .eslintcache
17
- .lint-todo/
18
-
19
- # ember-try
20
- /.node_modules.ember-try/
21
- /bower.json.ember-try
22
- /npm-shrinkwrap.json.ember-try
23
- /package.json.ember-try
24
- /package-lock.json.ember-try
25
- /yarn.lock.ember-try
package/.prettierrc.js DELETED
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- singleQuote: true,
5
- };
package/CONTRIBUTING.md DELETED
@@ -1,27 +0,0 @@
1
- # How To Contribute
2
-
3
- ## Installation
4
-
5
- - `git clone https://github.com/ember-cli/ember-exam.git`
6
- - `cd ember-exam`
7
- - `yarn install`
8
-
9
- ## Linting
10
-
11
- - `yarn lint:hbs`
12
- - `yarn lint:js`
13
- - `yarn lint:js --fix`
14
-
15
- ## Running tests
16
-
17
- - `ember test` – Runs the test suite on the current Ember version
18
- - `ember test --server` – Runs the test suite in "watch mode"
19
- - `yarn test:node` - Runs the node tests
20
- - `yarn test:all` – Runs the test suite against multiple Ember versions
21
-
22
- ## Running the dummy application
23
-
24
- - `ember serve`
25
- - Visit the dummy application at [http://localhost:4200](http://localhost:4200).
26
-
27
- For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
package/RELEASE.md DELETED
@@ -1,60 +0,0 @@
1
- # Release Process
2
-
3
- Releases are mostly automated using
4
- [release-it](https://github.com/release-it/release-it/) and
5
- [lerna-changelog](https://github.com/lerna/lerna-changelog/).
6
-
7
- ## Preparation
8
-
9
- Since the majority of the actual release process is automated, the primary
10
- remaining task prior to releasing is confirming that all pull requests that
11
- have been merged since the last release have been labeled with the appropriate
12
- `lerna-changelog` labels and the titles have been updated to ensure they
13
- represent something that would make sense to our users. Some great information
14
- on why this is important can be found at
15
- [keepachangelog.com](https://keepachangelog.com/en/1.0.0/), but the overall
16
- guiding principle here is that changelogs are for humans, not machines.
17
-
18
- When reviewing merged PR's the labels to be used are:
19
-
20
- * breaking - Used when the PR is considered a breaking change.
21
- * enhancement - Used when the PR adds a new feature or enhancement.
22
- * bug - Used when the PR fixes a bug included in a previous release.
23
- * documentation - Used when the PR adds or updates documentation.
24
- * internal - Used for internal changes that still require a mention in the
25
- changelog/release notes.
26
-
27
- ## Release
28
-
29
- Once the prep work is completed, the actual release is straight forward:
30
-
31
- * First, ensure that you have installed your projects dependencies:
32
-
33
- ```sh
34
- yarn install
35
- ```
36
-
37
- * Second, ensure that you have obtained a
38
- [GitHub personal access token][generate-token] with the `repo` scope (no
39
- other permissions are needed). Make sure the token is available as the
40
- `GITHUB_AUTH` environment variable.
41
-
42
- For instance:
43
-
44
- ```bash
45
- export GITHUB_AUTH=abc123def456
46
- ```
47
-
48
- [generate-token]: https://github.com/settings/tokens/new?scopes=repo&description=GITHUB_AUTH+env+variable
49
-
50
- * And last (but not least 😁) do your release.
51
-
52
- ```sh
53
- npx release-it
54
- ```
55
-
56
- [release-it](https://github.com/release-it/release-it/) manages the actual
57
- release process. It will prompt you to to choose the version number after which
58
- you will have the chance to hand tweak the changelog to be used (for the
59
- `CHANGELOG.md` and GitHub release), then `release-it` continues on to tagging,
60
- pushing the tag and commits, etc.
@@ -1,6 +0,0 @@
1
- {
2
- "env": {
3
- "browser": true,
4
- "node": false
5
- }
6
- }
@@ -1,5 +0,0 @@
1
- #!/bin/bash
2
- set -ev
3
- if [ "${TEST_FRAMEWORK}" = "ember-mocha" ]; then
4
- yarn remove ember-qunit 2>/dev/null && echo "n" | ember install ember-mocha || true
5
- fi
package/config/deploy.js DELETED
@@ -1,29 +0,0 @@
1
- /* eslint-env node */
2
- 'use strict';
3
-
4
- module.exports = function (deployTarget) {
5
- let ENV = {
6
- build: {},
7
- // include other plugin configuration that applies to all deploy targets here
8
- };
9
-
10
- if (deployTarget === 'development') {
11
- ENV.build.environment = 'development';
12
- // configure other plugins for development deploy target here
13
- }
14
-
15
- if (deployTarget === 'staging') {
16
- ENV.build.environment = 'production';
17
- // configure other plugins for staging deploy target here
18
- }
19
-
20
- if (deployTarget === 'production') {
21
- ENV.build.environment = 'production';
22
- // configure other plugins for production deploy target here
23
- }
24
-
25
- // Note: if you need to build some configuration asynchronously, you can return
26
- // a promise that resolves with the ENV object instead of returning the
27
- // ENV object synchronously.
28
- return ENV;
29
- };
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = function (/* environment, appConfig */) {
4
- return {};
5
- };
package/lib/.eslintrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "rules": {
3
- "no-var": 0
4
- }
5
- }
@@ -1,8 +0,0 @@
1
- {
2
- "env": {
3
- "mocha": true
4
- },
5
- "rules": {
6
- "no-var": 0
7
- }
8
- }
@@ -1,177 +0,0 @@
1
- 'use strict';
2
-
3
- const assert = require('assert');
4
- const execa = require('execa');
5
- const rimraf = require('rimraf');
6
- const fs = require('fs-extra');
7
- const path = require('path');
8
-
9
- function assertExpectRejection() {
10
- assert.ok(false, 'Expected promise to reject, but it fullfilled');
11
- }
12
-
13
- describe('Acceptance | Exam Iterate Command', function () {
14
- this.timeout(300000);
15
-
16
- it('should build the app, test it a number of times, and clean it up', function () {
17
- return execa('ember', ['exam:iterate', '2'], (child) => {
18
- const stdout = child.stdout;
19
- assert.ok(
20
- stdout.includes('Building app for test iterations.'),
21
- 'Logged building message from command'
22
- );
23
- assert.ok(
24
- stdout.includes('Built project successfully.'),
25
- 'Built successfully according to Ember-CLI'
26
- );
27
-
28
- assert.ok(
29
- stdout.includes('Running iteration #1.'),
30
- 'Logs first iteration'
31
- );
32
- assert.ok(
33
- stdout.includes('Running iteration #2.'),
34
- 'Logs second iteration'
35
- );
36
-
37
- const seedRE = /Randomizing tests with seed: (.*)/g;
38
-
39
- const firstSeed = seedRE.exec(stdout)[1];
40
- const secondSeed = seedRE.exec(stdout)[1];
41
-
42
- assert.ok(firstSeed, 'first seed exists');
43
- assert.ok(secondSeed, 'second seed exists');
44
- assert.notEqual(
45
- firstSeed,
46
- secondSeed,
47
- 'the first and second seeds are not the same'
48
- );
49
-
50
- assert.ok(
51
- stdout.includes('Cleaning up test iterations.'),
52
- 'Logged cleaning up message from command'
53
- );
54
- assert.throws(
55
- () => fs.accessSync('iteration-dist', fs.F_OK),
56
- 'iteration-dist is cleaned up'
57
- );
58
- });
59
- });
60
-
61
- it('should test the app with additional options passed in and catch failure cases', function () {
62
- const execution = execa('ember', [
63
- 'exam:iterate',
64
- '2',
65
- '--options',
66
- '--parallel',
67
- ]);
68
- return execution.then(assertExpectRejection, (error) => {
69
- const splitErrorRE =
70
- /You must specify the `split` option in order to run your tests in parallel./g;
71
-
72
- assert.ok(
73
- splitErrorRE.test(error.stderr),
74
- 'expected stderr to contain the appropriate error message'
75
- );
76
- assert.equal(error.exitCode, 1);
77
- assert.equal(error.failed, true);
78
- assert.equal(error.killed, false);
79
- });
80
- });
81
-
82
- describe('building', function () {
83
- const buildDir = path.join(process.cwd(), 'dist');
84
-
85
- afterEach(() => rimraf.sync(buildDir));
86
-
87
- it('should not build the app or clean it up, but use an existing build to test', function () {
88
- execa.sync('ember', ['build']);
89
-
90
- return execa('ember', ['exam:iterate', '2', '--path', 'dist']).then(
91
- (child) => {
92
- const stdout = child.stdout;
93
-
94
- assert.ok(
95
- !stdout.includes('Building app for test iterations.'),
96
- 'No logged building message from command'
97
- );
98
- assert.ok(
99
- !stdout.includes('Built project successfully.'),
100
- 'Not built successfully according to Ember-CLI'
101
- );
102
-
103
- assert.ok(
104
- stdout.includes('Running iteration #1.'),
105
- 'Logs first iteration'
106
- );
107
- assert.ok(
108
- stdout.includes('Running iteration #2.'),
109
- 'Logs second iteration'
110
- );
111
-
112
- const seedRE = /Randomizing tests with seed: (.*)/g;
113
-
114
- const firstSeed = seedRE.exec(stdout)[1];
115
- const secondSeed = seedRE.exec(stdout)[1];
116
-
117
- assert.ok(firstSeed, 'first seed exists');
118
- assert.ok(secondSeed, 'second seed exists');
119
- assert.notEqual(
120
- firstSeed,
121
- secondSeed,
122
- 'the first and second seeds are not the same'
123
- );
124
-
125
- assert.ok(
126
- !stdout.includes('Cleaning up test iterations.'),
127
- 'No logged cleaning up message from command'
128
- );
129
- assert.throws(
130
- () => fs.accessSync('iteration-dist', fs.F_OK),
131
- 'iteration-dist is non-existent'
132
- );
133
-
134
- assert.doesNotThrow(
135
- () => fs.accessSync(buildDir, fs.F_OK),
136
- 'dist is not cleaned up'
137
- );
138
- }
139
- );
140
- });
141
- });
142
-
143
- describe('Exit Code', function () {
144
- const destPath = path.join(
145
- __dirname,
146
- '..',
147
- '..',
148
- 'tests',
149
- 'unit',
150
- 'failing-test.js'
151
- );
152
-
153
- beforeEach(function () {
154
- const failingTestPath = path.join(
155
- __dirname,
156
- '..',
157
- 'fixtures',
158
- 'failure.js'
159
- );
160
- fs.copySync(failingTestPath, destPath);
161
- });
162
-
163
- afterEach(function () {
164
- fs.removeSync(destPath);
165
- });
166
-
167
- it('should have an exitCode of 1 when a test fails', function () {
168
- return execa('ember', ['exam:iterate', '1']).then(
169
- assertExpectRejection,
170
- (error) => {
171
- assert.equal(error.exitCode, 1);
172
- assert.equal(error.killed, false);
173
- }
174
- );
175
- });
176
- });
177
- });