ember-testem 0.2.0 → 0.3.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
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# ember-testem
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
_Backward- and forward-compatible testing for Ember projects_
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
## Quickstart
|
|
7
7
|
|
|
8
|
-
1\. Install `ember-testem` as a development dependency.
|
|
8
|
+
1\. Install `ember-testem` as a development dependency. The package provides an executable named `ember-test`.
|
|
9
9
|
|
|
10
10
|
```sh
|
|
11
11
|
pnpm add -D ember-testem
|
|
@@ -46,13 +46,17 @@ export default {
|
|
|
46
46
|
+ "build:test": "...",
|
|
47
47
|
- "test": "ember test"
|
|
48
48
|
+ "test": "pnpm build:test && ember-test"
|
|
49
|
+
+ "test:watch": "concurrently \"pnpm build:test --watch\" && \"pnpm ember-test --server\" --names build,test"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
52
|
+
"concurrently": "...",
|
|
51
53
|
+ "ember-testem": "..."
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
```
|
|
55
57
|
|
|
58
|
+
Note, `test:watch` can encounter race conditions. Once the test build is complete, refresh the test browser to see the latest results.
|
|
59
|
+
|
|
56
60
|
<details>
|
|
57
61
|
|
|
58
62
|
<summary>V1 addons</summary>
|
|
@@ -99,7 +103,7 @@ For brevity, additional file changes aren't shown below. For example, you will n
|
|
|
99
103
|
{
|
|
100
104
|
"scripts": {
|
|
101
105
|
"build": "rollup --config",
|
|
102
|
-
"build:test": "NODE_ENV=development vite build --config
|
|
106
|
+
"build:test": "NODE_ENV=development vite build --config vite.test.config.mts --mode development"
|
|
103
107
|
}
|
|
104
108
|
}
|
|
105
109
|
```
|
|
@@ -125,6 +129,7 @@ export default defineConfig({
|
|
|
125
129
|
babel({
|
|
126
130
|
babelHelpers: 'inline',
|
|
127
131
|
extensions,
|
|
132
|
+
parallel: true,
|
|
128
133
|
}),
|
|
129
134
|
],
|
|
130
135
|
});
|
|
@@ -142,24 +147,24 @@ See [my-v2-app](../../tests/my-v2-app) for an example.
|
|
|
142
147
|
{
|
|
143
148
|
"scripts": {
|
|
144
149
|
"build": "vite build",
|
|
145
|
-
"build:test": "NODE_ENV=development vite build --config
|
|
150
|
+
"build:test": "NODE_ENV=development vite build --config vite.test.config.mts --mode development"
|
|
146
151
|
}
|
|
147
152
|
}
|
|
148
153
|
```
|
|
149
154
|
|
|
150
155
|
```ts
|
|
151
156
|
/* vite.test.config.mts */
|
|
152
|
-
import
|
|
157
|
+
import { defineConfig } from 'vite';
|
|
153
158
|
|
|
154
159
|
import baseConfiguration from './vite.config.mts';
|
|
155
160
|
|
|
156
|
-
export default {
|
|
161
|
+
export default defineConfig({
|
|
157
162
|
...baseConfiguration,
|
|
158
163
|
build: {
|
|
159
164
|
minify: false,
|
|
160
165
|
sourcemap: true,
|
|
161
166
|
},
|
|
162
|
-
}
|
|
167
|
+
});
|
|
163
168
|
```
|
|
164
169
|
|
|
165
170
|
</details>
|
|
@@ -209,7 +214,7 @@ By default, `ember-testem` assumes `dist` to be the path to the test build.
|
|
|
209
214
|
Pass `--path` to indicate otherwise. This may be useful if you want to create the production and test builds in different locations.
|
|
210
215
|
|
|
211
216
|
```sh
|
|
212
|
-
ember-test --path
|
|
217
|
+
ember-test --path dist-for-testing
|
|
213
218
|
```
|
|
214
219
|
|
|
215
220
|
</details>
|
|
@@ -220,10 +225,10 @@ ember-test --path "dist-for-testing"
|
|
|
220
225
|
|
|
221
226
|
By default, `ember-testem` runs tests on port `7357`.
|
|
222
227
|
|
|
223
|
-
Pass `--test-port
|
|
228
|
+
Pass `--port` (or `--test-port`, currently supported for backward compatibility) to pick a different port. You can pass `0` to pick any available port (useful for testing multiple projects in parallel).
|
|
224
229
|
|
|
225
230
|
```sh
|
|
226
|
-
ember-test --
|
|
231
|
+
ember-test --port 0
|
|
227
232
|
```
|
|
228
233
|
|
|
229
234
|
</details>
|
package/dist/bin/ember-test.js
CHANGED
|
@@ -18,11 +18,16 @@ const argv = yargs(hideBin(process.argv))
|
|
|
18
18
|
type: 'string',
|
|
19
19
|
})
|
|
20
20
|
.option('path', {
|
|
21
|
+
default: 'dist',
|
|
21
22
|
describe: 'Relative path to the test build',
|
|
22
23
|
type: 'string',
|
|
24
|
+
})
|
|
25
|
+
.option('port', {
|
|
26
|
+
describe: 'Port for running tests. Pass 0 to automatically pick an available port.',
|
|
27
|
+
type: 'number',
|
|
23
28
|
})
|
|
24
29
|
.option('root', {
|
|
25
|
-
describe: '
|
|
30
|
+
describe: 'Project root',
|
|
26
31
|
type: 'string',
|
|
27
32
|
})
|
|
28
33
|
.option('server', {
|
|
@@ -34,15 +39,16 @@ const argv = yargs(hideBin(process.argv))
|
|
|
34
39
|
describe: 'Port for running tests. Pass 0 to automatically pick an available port.',
|
|
35
40
|
type: 'number',
|
|
36
41
|
})
|
|
42
|
+
.deprecateOption('test-port', 'Use --port instead.')
|
|
37
43
|
.parseSync();
|
|
38
44
|
const codemodOptions = {
|
|
39
|
-
buildPath: argv['path']
|
|
45
|
+
buildPath: argv['path'],
|
|
40
46
|
filters: {
|
|
41
47
|
filter: argv['filter'],
|
|
42
48
|
module: argv['module'],
|
|
43
49
|
},
|
|
50
|
+
port: argv['test-port'] ?? argv['port'],
|
|
44
51
|
projectRoot: argv['root'] ?? process.cwd(),
|
|
45
52
|
server: argv['server'],
|
|
46
|
-
testPort: argv['test-port'],
|
|
47
53
|
};
|
|
48
54
|
void run(codemodOptions);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export function createOptions(codemodOptions) {
|
|
2
|
-
const { buildPath, filters, projectRoot, server
|
|
2
|
+
const { buildPath, filters, port, projectRoot, server } = codemodOptions;
|
|
3
3
|
return {
|
|
4
4
|
buildPath,
|
|
5
5
|
filters,
|
|
6
6
|
launchBrowser: Boolean(server),
|
|
7
|
+
port,
|
|
7
8
|
projectRoot,
|
|
8
|
-
testPort,
|
|
9
9
|
};
|
|
10
10
|
}
|
|
@@ -2,11 +2,11 @@ import { join } from 'node:path';
|
|
|
2
2
|
import Testem from 'testem';
|
|
3
3
|
import { getQueryParams } from '../../utils/run-tests/get-query-params.js';
|
|
4
4
|
export async function runTestsInCI(options) {
|
|
5
|
-
const { buildPath, filters,
|
|
5
|
+
const { buildPath, filters, port, projectRoot } = options;
|
|
6
6
|
const testemInstance = new Testem();
|
|
7
7
|
const startOptions = {
|
|
8
8
|
launch: false,
|
|
9
|
-
port
|
|
9
|
+
port,
|
|
10
10
|
};
|
|
11
11
|
testemInstance.setDefaultOptions({
|
|
12
12
|
...startOptions,
|
|
@@ -3,11 +3,11 @@ import { watch } 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
|
-
const { buildPath, filters,
|
|
6
|
+
const { buildPath, filters, port, projectRoot } = options;
|
|
7
7
|
const testemInstance = new Testem();
|
|
8
8
|
const startOptions = {
|
|
9
9
|
launch: false,
|
|
10
|
-
port
|
|
10
|
+
port,
|
|
11
11
|
};
|
|
12
12
|
testemInstance.setDefaultOptions({
|
|
13
13
|
...startOptions,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-testem",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Backward- and forward-compatible testing for Ember projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ci",
|
|
7
7
|
"ember",
|