ember-testem 0.2.0 → 0.3.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.
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # ember-testem
2
2
 
3
- _Forward- and backward-compatible testing for Ember projects_
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 \"vite.test.config.mts\" --mode development"
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 \"vite.test.config.mts\" --mode development"
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 type { UserConfig } from 'vite';
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
- } satisfies UserConfig;
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 "dist-for-testing"
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` to pick a different port. You can pass `0` to pick any available port (useful for testing multiple projects in parallel).
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 --test-port 0
231
+ ember-test --port 0
227
232
  ```
228
233
 
229
234
  </details>
@@ -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: 'Where to run the codemod',
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'] ?? 'dist',
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, testPort } = codemodOptions;
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, projectRoot, testPort } = options;
5
+ const { buildPath, filters, port, projectRoot } = options;
6
6
  const testemInstance = new Testem();
7
7
  const startOptions = {
8
8
  launch: false,
9
- port: testPort,
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, projectRoot, testPort } = options;
6
+ const { buildPath, filters, port, projectRoot } = options;
7
7
  const testemInstance = new Testem();
8
8
  const startOptions = {
9
9
  launch: false,
10
- port: testPort,
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.2.0",
4
- "description": "Forward- and backward-compatible testing for Ember projects",
3
+ "version": "0.3.1",
4
+ "description": "Backward- and forward-compatible testing for Ember projects",
5
5
  "keywords": [
6
6
  "ci",
7
7
  "ember",
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "chokidar": "^5.0.0",
29
- "testem": "^3.21.0",
29
+ "testem": "^3.21.3",
30
30
  "yargs": "^18.2.0"
31
31
  },
32
32
  "devDependencies": {
@@ -37,7 +37,7 @@
37
37
  "@types/node": "^22.20.4",
38
38
  "@types/yargs": "^17.0.35",
39
39
  "concurrently": "^10.0.5",
40
- "eslint": "^10.11.0",
40
+ "eslint": "^10.12.0",
41
41
  "prettier": "^3.9.9",
42
42
  "typescript": "^6.0.3"
43
43
  },