ember-testem 0.5.2 → 0.6.0
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.
package/README.md
CHANGED
|
@@ -16,6 +16,10 @@ Until now, testing Ember apps and addons required `ember-cli`, a monolith packag
|
|
|
16
16
|
|
|
17
17
|
## Quickstart
|
|
18
18
|
|
|
19
|
+
> [!TIP]
|
|
20
|
+
>
|
|
21
|
+
> From the root of your Ember app or addon, run `pnpx install-ember-testem` to automate the setup.
|
|
22
|
+
|
|
19
23
|
1\. Install `ember-testem` as a development dependency. The package provides an executable named `ember-test`.
|
|
20
24
|
|
|
21
25
|
```sh
|
|
@@ -129,9 +133,8 @@ If you still want to create the test app in the same package, you will need to i
|
|
|
129
133
|
|
|
130
134
|
Files that need changes:
|
|
131
135
|
|
|
132
|
-
- Babel (`babel.
|
|
136
|
+
- Babel (`babel.test.config.mjs`)
|
|
133
137
|
- Dependencies (`package.json`)
|
|
134
|
-
- Rollup (`rollup.config.mjs`)
|
|
135
138
|
- TypeScript (`tsconfig.json`, `tsconfig.build.json`)
|
|
136
139
|
- Vite (`vite.test.config.mts`)
|
|
137
140
|
|
|
@@ -260,7 +263,7 @@ ember-test --random gflqlwrm59j
|
|
|
260
263
|
|
|
261
264
|
## Compatibility
|
|
262
265
|
|
|
263
|
-
- Node.js v22.
|
|
266
|
+
- Node.js v22.22 or above
|
|
264
267
|
|
|
265
268
|
|
|
266
269
|
## Contributing
|
|
@@ -3,12 +3,12 @@ import Testem from 'testem';
|
|
|
3
3
|
import { getQueryParams } from '../../utils/run-tests/get-query-params.js';
|
|
4
4
|
export async function runTestsInCI(options) {
|
|
5
5
|
const { buildPath, port, projectRoot } = options;
|
|
6
|
-
const
|
|
6
|
+
const testem = new Testem();
|
|
7
7
|
const startOptions = {
|
|
8
8
|
launch: false,
|
|
9
9
|
port,
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
testem.setDefaultOptions({
|
|
12
12
|
...startOptions,
|
|
13
13
|
config_dir: projectRoot,
|
|
14
14
|
cwd: join(projectRoot, buildPath),
|
|
@@ -16,7 +16,7 @@ export async function runTestsInCI(options) {
|
|
|
16
16
|
query_params: getQueryParams(options),
|
|
17
17
|
});
|
|
18
18
|
return new Promise((resolve, reject) => {
|
|
19
|
-
|
|
19
|
+
testem.startCI(startOptions, (exitCode, error) => {
|
|
20
20
|
if (error) {
|
|
21
21
|
reject(error);
|
|
22
22
|
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
|
-
import
|
|
2
|
+
import chokidar from 'chokidar';
|
|
3
3
|
import Testem from 'testem';
|
|
4
4
|
import { getQueryParams } from '../../utils/run-tests/get-query-params.js';
|
|
5
5
|
export async function runTestsInDev(options) {
|
|
6
6
|
const { buildPath, port, projectRoot } = options;
|
|
7
|
-
const
|
|
7
|
+
const testem = new Testem();
|
|
8
8
|
const startOptions = {
|
|
9
9
|
launch: false,
|
|
10
10
|
port,
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
testem.setDefaultOptions({
|
|
13
13
|
...startOptions,
|
|
14
14
|
config_dir: projectRoot,
|
|
15
15
|
cwd: join(projectRoot, buildPath),
|
|
16
16
|
query_params: getQueryParams(options),
|
|
17
17
|
});
|
|
18
|
-
const watcher = watch([buildPath], {
|
|
18
|
+
const watcher = chokidar.watch([buildPath], {
|
|
19
19
|
awaitWriteFinish: true,
|
|
20
20
|
backend: 'polling',
|
|
21
21
|
});
|
|
22
22
|
watcher.on('change', () => {
|
|
23
|
-
|
|
23
|
+
testem.restart();
|
|
24
24
|
});
|
|
25
25
|
return new Promise((resolve, reject) => {
|
|
26
|
-
|
|
26
|
+
testem.startDev(startOptions, (exitCode, error) => {
|
|
27
27
|
if (error) {
|
|
28
28
|
reject(error);
|
|
29
29
|
}
|
|
30
30
|
else if (exitCode !== 0) {
|
|
31
|
-
reject(new Error(`testem finished with
|
|
31
|
+
reject(new Error(`testem finished with the non-zero exit code ${exitCode}`));
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
34
|
resolve();
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
function generateSeed() {
|
|
2
|
+
return Math.random().toString(36).slice(2);
|
|
3
|
+
}
|
|
1
4
|
export function createSeed(seed) {
|
|
2
5
|
switch (seed) {
|
|
3
6
|
case undefined: {
|
|
4
7
|
return undefined;
|
|
5
8
|
}
|
|
6
9
|
case '': {
|
|
7
|
-
|
|
10
|
+
let seedNew = generateSeed();
|
|
11
|
+
while (seedNew === '') {
|
|
12
|
+
seedNew = generateSeed();
|
|
13
|
+
}
|
|
8
14
|
console.log(`Randomizing tests with seed: ${seedNew}`);
|
|
9
15
|
return seedNew;
|
|
10
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-testem",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Backward- and forward-compatible testing for Ember projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ci",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"chokidar": "^6.0.0",
|
|
29
|
-
"testem": "^4.0.0-beta.
|
|
29
|
+
"testem": "^4.0.0-beta.3",
|
|
30
30
|
"yargs": "^18.2.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -35,14 +35,16 @@
|
|
|
35
35
|
"@shared-configs/prettier": "0.0.0",
|
|
36
36
|
"@shared-configs/typescript": "0.0.0",
|
|
37
37
|
"@types/node": "^22.20.5",
|
|
38
|
+
"@types/sinon": "^22.0.2",
|
|
38
39
|
"@types/yargs": "^17.0.35",
|
|
39
40
|
"concurrently": "^10.0.6",
|
|
40
41
|
"eslint": "^10.13.0",
|
|
41
42
|
"prettier": "^3.9.10",
|
|
43
|
+
"sinon": "^22.1.0",
|
|
42
44
|
"typescript": "^6.0.3"
|
|
43
45
|
},
|
|
44
46
|
"engines": {
|
|
45
|
-
"node": "^22.
|
|
47
|
+
"node": "^22.22.0 || >= 24"
|
|
46
48
|
},
|
|
47
49
|
"scripts": {
|
|
48
50
|
"build": "sh build.sh --production",
|