@ember/app-blueprint 0.8.2 → 6.7.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 (64) hide show
  1. package/.github/workflows/{plan-release.yml → plan-stable-release.yml} +5 -6
  2. package/.github/workflows/{publish.yml → publish-stable.yml} +2 -3
  3. package/.prettierignore +1 -2
  4. package/.release-plan.json +4 -4
  5. package/CHANGELOG.md +47 -0
  6. package/README.md +10 -0
  7. package/eslint.config.mjs +1 -5
  8. package/files/package.json +43 -43
  9. package/package.json +2 -2
  10. package/tests/arguments.test.mjs +155 -0
  11. package/tests/fixtures/tests-js-10/app/components/.gitkeep +0 -0
  12. package/tests/fixtures/tests-js-10/app/components/sweet.gjs +3 -0
  13. package/tests/{fixture → fixtures/tests-js-10}/app/router.js +2 -3
  14. package/tests/fixtures/tests-js-10/app/routes/.gitkeep +0 -0
  15. package/tests/{fixture/app/routes/styles.js → fixtures/tests-js-10/app/routes/fancy.js} +1 -1
  16. package/tests/fixtures/tests-js-10/app/styles/app.css +3 -0
  17. package/tests/fixtures/tests-js-10/app/templates/application.gjs +15 -0
  18. package/tests/fixtures/tests-js-10/app/templates/fancy.gjs +12 -0
  19. package/tests/fixtures/tests-js-10/tests/acceptance/index-test.js +26 -0
  20. package/tests/fixtures/tests-js-10/tests/integration/components/sweet-test.gjs +28 -0
  21. package/tests/fixtures/tests-js-10/tests/routes/fancy-test.js +11 -0
  22. package/tests/{fixture-ts/testem-proxy.js → fixtures/tests-js-20/testem-dev.js} +26 -2
  23. package/tests/fixtures/tests-ts-10/app/components/.gitkeep +0 -0
  24. package/tests/fixtures/tests-ts-10/app/components/sweet.gts +3 -0
  25. package/tests/{fixture-ts → fixtures/tests-ts-10}/app/router.ts +2 -3
  26. package/tests/fixtures/tests-ts-10/app/routes/.gitkeep +0 -0
  27. package/tests/{fixture-ts/app/routes/styles.ts → fixtures/tests-ts-10/app/routes/fancy.ts} +1 -1
  28. package/tests/fixtures/tests-ts-10/app/styles/app.css +3 -0
  29. package/tests/fixtures/tests-ts-10/app/templates/application.gts +15 -0
  30. package/tests/fixtures/tests-ts-10/app/templates/fancy.gts +12 -0
  31. package/tests/fixtures/tests-ts-10/tests/acceptance/index-test.ts +26 -0
  32. package/tests/fixtures/tests-ts-10/tests/integration/components/sweet-test.gjs +28 -0
  33. package/tests/fixtures/tests-ts-10/tests/routes/fancy-test.js +11 -0
  34. package/tests/generators.test.mjs +60 -0
  35. package/tests/helpers.mjs +26 -91
  36. package/tests/lint.test.mjs +27 -10
  37. package/tests/tests.test.mjs +218 -0
  38. package/vitest.config.ts +2 -2
  39. package/tests/default.test.mjs +0 -155
  40. package/tests/fixture/app/components/custom-component.hbs +0 -3
  41. package/tests/fixture/app/styles/app.css +0 -5
  42. package/tests/fixture/app/templates/application.hbs +0 -3
  43. package/tests/fixture/app/templates/custom-component.hbs +0 -1
  44. package/tests/fixture/app/templates/index.hbs +0 -1
  45. package/tests/fixture/app/templates/styles.hbs +0 -5
  46. package/tests/fixture/testem-proxy.js +0 -35
  47. package/tests/fixture/tests/acceptance/custom-component-test.js +0 -14
  48. package/tests/fixture/tests/acceptance/styles-test.js +0 -18
  49. package/tests/fixture-ts/app/styles/app.css +0 -5
  50. package/tests/fixture-ts/app/templates/components/custom.gts +0 -5
  51. package/tests/fixture-ts/app/templates/custom-component.gts +0 -5
  52. package/tests/fixture-ts/app/templates/index.gts +0 -5
  53. package/tests/fixture-ts/app/templates/styles.gts +0 -7
  54. package/tests/fixture-ts/tests/acceptance/custom-component-test.ts +0 -14
  55. package/tests/fixture-ts/tests/acceptance/styles-test.ts +0 -18
  56. package/tests/typescript.test.mjs +0 -24
  57. /package/tests/{fixture → fixtures/tests-js-10}/app/initializers/test-init.js +0 -0
  58. /package/tests/{fixture → fixtures/tests-js-10}/app/instance-initializers/test-instance-init.js +0 -0
  59. /package/tests/{fixture → fixtures/tests-js-10}/tests/acceptance/app-init-test.js +0 -0
  60. /package/tests/{fixture → fixtures/tests-js-10}/tests/acceptance/welcome-page-test.js +0 -0
  61. /package/tests/{fixture-ts → fixtures/tests-ts-10}/app/initializers/test-init.ts +0 -0
  62. /package/tests/{fixture-ts → fixtures/tests-ts-10}/app/instance-initializers/test-instance-init.ts +0 -0
  63. /package/tests/{fixture-ts → fixtures/tests-ts-10}/tests/acceptance/app-init-test.ts +0 -0
  64. /package/tests/{fixture-ts → fixtures/tests-ts-10}/tests/acceptance/welcome-page-test.ts +0 -0
@@ -1,4 +1,4 @@
1
- import EmberRouter from '@ember/routing/router';
1
+ import EmberRouter from '@embroider/router';
2
2
  import config from 'test-app/config/environment';
3
3
 
4
4
  export default class Router extends EmberRouter {
@@ -7,6 +7,5 @@ export default class Router extends EmberRouter {
7
7
  }
8
8
 
9
9
  Router.map(function () {
10
- this.route('styles');
11
- this.route('custom-component');
10
+ this.route('fancy');
12
11
  });
File without changes
@@ -3,6 +3,6 @@ import { service } from '@ember/service';
3
3
 
4
4
  import type RouterService from '@ember/routing/router-service';
5
5
 
6
- export default class StylesRoute extends Route {
6
+ export default class FancyRoute extends Route {
7
7
  @service declare router: RouterService;
8
8
  }
@@ -0,0 +1,3 @@
1
+ .purple {
2
+ color: rebeccapurple;
3
+ }
@@ -0,0 +1,15 @@
1
+ import { pageTitle } from 'ember-page-title';
2
+ import { WelcomePage } from 'ember-welcome-page';
3
+ import { LinkTo } from '@ember/routing';
4
+
5
+ <template>
6
+ {{pageTitle "TestApp"}}
7
+
8
+ {{outlet}}
9
+
10
+ {{! The following component displays Ember's default welcome message. }}
11
+ <WelcomePage />
12
+ {{! Feel free to remove this! }}
13
+
14
+ <LinkTo @route="fancy" data-test-a>Fancy</LinkTo>
15
+ </template>
@@ -0,0 +1,12 @@
1
+ import { pageTitle } from 'ember-page-title';
2
+ import Sweet from '../components/sweet.gts';
3
+
4
+ <template>
5
+ {{pageTitle "Fancy"}}
6
+
7
+ <Sweet />
8
+
9
+ <p class="purple">Fancy</p>
10
+
11
+ {{outlet}}
12
+ </template>
@@ -0,0 +1,26 @@
1
+ import { module, test } from 'qunit';
2
+ import { visit, currentURL, click } from '@ember/test-helpers';
3
+ import { setupApplicationTest } from 'test-app/tests/helpers';
4
+
5
+ module('Acceptance | index', function (hooks) {
6
+ setupApplicationTest(hooks);
7
+
8
+ test('visiting /', async function (assert) {
9
+ await visit('/');
10
+
11
+ assert.strictEqual(currentURL(), '/');
12
+
13
+ await click('[data-test-a]');
14
+
15
+ assert.strictEqual(currentURL(), '/fancy');
16
+
17
+ assert.dom('p').hasText('Fancy');
18
+
19
+ assert.dom('p.purple').hasStyle(
20
+ {
21
+ 'color': 'rgb(102, 51, 153)',
22
+ },
23
+ 'The text should be purple if the app styles are working correctly',
24
+ )
25
+ });
26
+ });
@@ -0,0 +1,28 @@
1
+ import { module, test } from 'qunit';
2
+ import { setupRenderingTest } from 'test-app/tests/helpers';
3
+ import { render } from '@ember/test-helpers';
4
+ import Sweet from 'test-app/components/sweet';
5
+
6
+ module('Integration | Component | sweet', function (hooks) {
7
+ setupRenderingTest(hooks);
8
+
9
+ test('it renders', async function (assert) {
10
+ // Updating values is achieved using autotracking, just like in app code. For example:
11
+ // class State { @tracked myProperty = 0; }; const state = new State();
12
+ // and update using state.myProperty = 1; await rerender();
13
+ // Handle any actions with function myAction(val) { ... };
14
+
15
+ await render(<template><Sweet /></template>);
16
+
17
+ assert.dom().hasText('');
18
+
19
+ // Template block usage:
20
+ await render(<template>
21
+ <Sweet>
22
+ template block text
23
+ </Sweet>
24
+ </template>);
25
+
26
+ assert.dom().hasText('template block text');
27
+ });
28
+ });
@@ -0,0 +1,11 @@
1
+ import { module, test } from 'qunit';
2
+ import { setupTest } from 'test-app/tests/helpers';
3
+
4
+ module('Unit | Route | fancy', function (hooks) {
5
+ setupTest(hooks);
6
+
7
+ test('it exists', function (assert) {
8
+ let route = this.owner.lookup('route:fancy');
9
+ assert.ok(route);
10
+ });
11
+ });
@@ -0,0 +1,60 @@
1
+ import { beforeAll, describe, it, expect } from 'vitest';
2
+
3
+ import { generateApp } from './helpers.mjs';
4
+
5
+ describe('Slow(JavaScript): Generate individual files', function () {
6
+ let app;
7
+
8
+ beforeAll(async function () {
9
+ app = await generateApp({ flags: ['--pnpm'], skipNpm: false });
10
+ });
11
+
12
+ it('can generate a route', async function () {
13
+ let { exitCode, stdout } = await app.execa('pnpm', [
14
+ 'ember',
15
+ 'g',
16
+ 'route',
17
+ 'fancy',
18
+ ]);
19
+
20
+ if (!process.env.CI) {
21
+ console.log(stdout);
22
+ }
23
+
24
+ expect(exitCode).to.equal(0);
25
+ expect(app.files.app.routes['fancy.js']).to.not.be.undefined;
26
+ expect(app.files.app['router.js']).to.contain(`this.route('fancy')`);
27
+ expect(app.files.tests.unit.routes['fancy-test.js']).to.not.be.undefined;
28
+ });
29
+
30
+ // Note: We could run additional generators here (component, controller, etc)
31
+ });
32
+
33
+ describe('Slow(TypeScript): Generate individual files', function () {
34
+ let app;
35
+
36
+ beforeAll(async function () {
37
+ app = await generateApp({
38
+ flags: ['--pnpm', '--typescript'],
39
+ skipNpm: false,
40
+ });
41
+ });
42
+
43
+ it('can generate a route', async function () {
44
+ let { exitCode, stdout } = await app.execa('pnpm', [
45
+ 'ember',
46
+ 'g',
47
+ 'route',
48
+ 'fancy',
49
+ ]);
50
+
51
+ if (!process.env.CI) {
52
+ console.log(stdout);
53
+ }
54
+
55
+ expect(exitCode).to.equal(0);
56
+ expect(app.files.app.routes['fancy.ts']).to.not.be.undefined;
57
+ expect(app.files.app['router.ts']).to.contain(`this.route('fancy')`);
58
+ expect(app.files.tests.unit.routes['fancy-test.ts']).to.not.be.undefined;
59
+ });
60
+ });
package/tests/helpers.mjs CHANGED
@@ -1,80 +1,45 @@
1
- import assert from 'node:assert';
2
-
3
- import { beforeAll } from 'vitest';
4
- import { sync as resolveBinSync } from 'resolve-bin';
5
1
  import { execa } from 'execa';
6
2
  import tmp from 'tmp-promise';
7
- import fs from 'node:fs/promises';
8
3
  import { join } from 'node:path';
9
4
  import fixturify from 'fixturify';
10
5
 
11
6
  let localEmberCli = require.resolve('ember-cli/bin/ember');
12
7
  const blueprintPath = join(__dirname, '..');
13
8
 
14
- function findEmber() {
15
- return resolveBinSync('ember-cli', { executable: 'ember' });
16
- }
17
-
18
- export const emberCli = findEmber();
19
-
20
- const appName = 'test-app';
21
-
22
- export function newProject({ name = appName, flags = [] } = {}) {
23
- let dir;
24
-
25
- beforeAll(async () => {
26
- const tmpDir = (await tmp.dir()).path;
27
- dir = join(tmpDir, name);
28
- await execa({
29
- cwd: tmpDir,
30
- })`${localEmberCli} new ${name} -b ${blueprintPath} --skip-git --pnpm ${flags}`;
31
- });
32
-
33
- return {
34
- appName: () => name,
35
- dir: () => dir,
36
- $: (...args) => execa({ cwd: dir })(...args),
37
- execa: (program, args, options = {}) => {
38
- return execa(program, args, {
39
- cwd: dir,
40
- ...options,
41
- });
42
- },
43
- };
44
- }
45
-
46
- export function newProjectWithFixtures({
9
+ export async function generateApp({
10
+ name = 'test-app',
47
11
  flags = [],
48
- fixturePath,
49
- packageJson = {},
50
- name = appName,
12
+ skipNpm = true,
51
13
  } = {}) {
52
- let dir;
14
+ const tmpDir = (await tmp.dir()).path;
15
+ const dir = join(tmpDir, name);
53
16
 
54
- assert(fixturePath, `a fixturePath is required`);
55
-
56
- beforeAll(async () => {
57
- const tmpDir = (await tmp.dir()).path;
58
- dir = join(tmpDir, name);
59
- await execa({
60
- cwd: tmpDir,
61
- })`${localEmberCli} new ${name} -b ${blueprintPath} --skip-git --pnpm ${flags}`;
17
+ if (skipNpm) {
18
+ flags.push('--skip-npm');
19
+ }
62
20
 
63
- let addonFixture = fixturify.readSync(fixturePath);
64
- fixturify.writeSync(dir, addonFixture);
21
+ const execaOptions = {
22
+ cwd: tmpDir,
23
+ };
65
24
 
66
- await mergePackageJson(dir, packageJson);
25
+ if (!process.env.CI) {
26
+ execaOptions.stdio = 'inherit';
27
+ }
67
28
 
68
- // Sync the lints for the fixtures with the project's config
69
- await execa(`pnpm`, ['lint:fix'], {
70
- cwd: dir,
71
- });
72
- });
29
+ const { stdout, stderr } = await execa(
30
+ localEmberCli,
31
+ ['new', name, '--blueprint', blueprintPath, '--skip-git', ...flags],
32
+ execaOptions,
33
+ );
73
34
 
74
35
  return {
75
- appName: () => name,
76
- dir: () => dir,
77
- $: (...args) => execa({ cwd: dir })(...args),
36
+ stdout,
37
+ stderr,
38
+ name,
39
+ dir,
40
+ get files() {
41
+ return fixturify.readSync(dir);
42
+ },
78
43
  execa: (program, args, options = {}) => {
79
44
  return execa(program, args, {
80
45
  cwd: dir,
@@ -83,33 +48,3 @@ export function newProjectWithFixtures({
83
48
  },
84
49
  };
85
50
  }
86
-
87
- async function mergePackageJson(dir, packageJson) {
88
- let rootKeys = Object.keys(packageJson || {});
89
-
90
- if (rootKeys.length === 0) {
91
- return;
92
- }
93
-
94
- let packageJsonPath = join(dir, 'package.json');
95
- let testPackageJson = JSON.parse(
96
- (await fs.readFile(packageJsonPath)).toString(),
97
- );
98
-
99
- for (let rootKey of rootKeys) {
100
- /**
101
- * For searchability in logs
102
- */
103
- console.log(`Modifying ${rootKey} in package.json @ ${packageJsonPath}`);
104
- let value = packageJson[rootKey];
105
-
106
- let isObject = typeof value === 'object' && !Array.isArray(value);
107
- if (!isObject) {
108
- throw new Error(`${rootKey} customization is currently not implemented`);
109
- }
110
-
111
- Object.assign(testPackageJson[rootKey], value);
112
- }
113
-
114
- await fs.writeFile(packageJsonPath, JSON.stringify(testPackageJson, null, 2));
115
- }
@@ -1,26 +1,43 @@
1
- import { describe, it, expect } from 'vitest';
1
+ import { beforeAll, describe, it, expect } from 'vitest';
2
2
 
3
- import { newProject } from './helpers.mjs';
3
+ import { generateApp } from './helpers.mjs';
4
4
 
5
5
  describe('linting & formatting', function () {
6
- describe('JavaScript', function () {
7
- let project = newProject();
6
+ let app;
8
7
 
9
- it('yields output for JavaScript without errors', async function () {
10
- let { exitCode } = await project.execa('pnpm', ['lint']);
8
+ beforeAll(async function () {
9
+ app = await generateApp({ flags: ['--typescript'], skipNpm: false });
10
+ });
11
+
12
+ describe('JavaScript', function () {
13
+ it('yields output without errors', async function () {
14
+ let { exitCode } = await app.execa('pnpm', ['lint']);
11
15
 
12
16
  expect(exitCode).to.equal(0);
13
17
  });
14
18
  });
15
19
 
16
20
  describe('TypeScript', function () {
17
- let project = newProject({
18
- flags: ['--typescript'],
21
+ let app;
22
+
23
+ beforeAll(async function () {
24
+ app = await generateApp({ flags: ['--typescript'], skipNpm: false });
19
25
  });
20
26
 
21
- it('yields output for JavaScript without errors', async function () {
22
- let { exitCode } = await project.execa('pnpm', ['lint']);
27
+ it('yields output without errors', async function () {
28
+ let { exitCode } = await app.execa('pnpm', ['lint']);
29
+
30
+ expect(exitCode).to.equal(0);
31
+ });
32
+
33
+ it('glint passes', async function () {
34
+ expect(
35
+ JSON.parse(app.files['package.json']).scripts['lint:types'],
36
+ ).to.equal('glint');
37
+
38
+ let { exitCode, stdout } = await app.execa('pnpm', ['lint:types']);
23
39
 
40
+ console.log(stdout);
24
41
  expect(exitCode).to.equal(0);
25
42
  });
26
43
  });
@@ -0,0 +1,218 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import fixturify from 'fixturify';
3
+ import stripAnsi from 'strip-ansi';
4
+
5
+ import { generateApp } from './helpers.mjs';
6
+
7
+ describe('Slow(JavaScript): Runs tests', async function () {
8
+ it('runs in a freshly generated app', async function () {
9
+ let app = await generateApp({ flags: ['--pnpm'], skipNpm: false });
10
+
11
+ let { stdout: stdout1, exitCode: exitCode1 } = await app.execa('pnpm', [
12
+ 'test',
13
+ ]);
14
+
15
+ if (!process.env.CI) {
16
+ console.log(stdout1);
17
+ }
18
+
19
+ expect(stdout1).to.contain('# tests 1');
20
+ expect(stdout1).to.contain('# pass 1');
21
+ expect(stdout1).to.contain('# skip 0');
22
+ expect(stdout1).to.contain('# todo 0');
23
+ expect(stdout1).to.contain('# ok');
24
+ expect(exitCode1).to.equal(0);
25
+ });
26
+
27
+ it('runs in an app with fixtures', async function () {
28
+ let app = await generateApp({ flags: ['--pnpm'], skipNpm: false });
29
+
30
+ fixturify.writeSync(
31
+ app.dir,
32
+ fixturify.readSync('./tests/fixtures/tests-js-10'),
33
+ );
34
+
35
+ let { stdout: stdout2, exitCode: exitCode2 } = await app.execa('pnpm', [
36
+ 'test',
37
+ ]);
38
+
39
+ if (!process.env.CI) {
40
+ console.log(stdout2);
41
+ }
42
+
43
+ expect(stdout2).to.match(/ok .* Acceptance \| app route/);
44
+ expect(stdout2).to.match(/ok .* Acceptance \| index/);
45
+ expect(stdout2).to.match(/ok .* Integration \| Component \| sweet/);
46
+ expect(stdout2).to.match(/ok .* Unit \| Route \| fancy/);
47
+ expect(stdout2).to.match(/ok .* Ember.onerror/);
48
+
49
+ expect(stdout2).to.contain('# tests 6');
50
+ expect(stdout2).to.contain('# pass 6');
51
+ expect(stdout2).to.contain('# skip 0');
52
+ expect(stdout2).to.contain('# todo 0');
53
+ expect(stdout2).to.contain('# ok');
54
+ expect(exitCode2).to.equal(0);
55
+ });
56
+
57
+ it('runs when serving /tests', async function () {
58
+ let app = await generateApp({ flags: ['--pnpm'], skipNpm: false });
59
+
60
+ await app.execa('pnpm', ['install', '--save-dev', 'testem', 'http-proxy']);
61
+
62
+ let fixtures = fixturify.readSync('./tests/fixtures/tests-js-20');
63
+ let server;
64
+
65
+ try {
66
+ server = app.execa('pnpm', ['start']);
67
+
68
+ let appURL = await new Promise((resolve) => {
69
+ // Read app url from Vite server output
70
+ server.stdout.on('data', (line) => {
71
+ let parsed = stripAnsi(line.toString());
72
+ let result = /Local:\s+(https?:\/\/.*)\//g.exec(parsed);
73
+
74
+ if (process.env.CI) {
75
+ console.log(parsed);
76
+ }
77
+
78
+ if (result) {
79
+ resolve(result[1]);
80
+ }
81
+ });
82
+ });
83
+
84
+ fixtures['testem-dev.js'] = fixtures['testem-dev.js'].replace(
85
+ '%APP_URL%',
86
+ appURL,
87
+ );
88
+ fixturify.writeSync(app.dir, fixtures);
89
+
90
+ let testResult = await app.execa('pnpm', [
91
+ 'testem',
92
+ '--file',
93
+ 'testem-dev.js',
94
+ 'ci',
95
+ ]);
96
+
97
+ if (process.env.CI) {
98
+ console.log(testResult.stdout);
99
+ console.log(testResult.stderr);
100
+ }
101
+
102
+ expect(testResult.exitCode).to.eq(0);
103
+ } finally {
104
+ server?.kill('SIGKILL');
105
+ }
106
+ });
107
+ });
108
+
109
+ describe('Slow(TypeScript): Runs tests', async function () {
110
+ it('runs in a freshly generated app', async function () {
111
+ let app = await generateApp({
112
+ flags: ['--pnpm', '--typescript'],
113
+ skipNpm: false,
114
+ });
115
+
116
+ let { stdout: stdout1, exitCode: exitCode1 } = await app.execa('pnpm', [
117
+ 'test',
118
+ ]);
119
+
120
+ if (!process.env.CI) {
121
+ console.log(stdout1);
122
+ }
123
+
124
+ expect(stdout1).to.contain('# tests 1');
125
+ expect(stdout1).to.contain('# pass 1');
126
+ expect(stdout1).to.contain('# skip 0');
127
+ expect(stdout1).to.contain('# todo 0');
128
+ expect(stdout1).to.contain('# ok');
129
+ expect(exitCode1).to.equal(0);
130
+ });
131
+
132
+ it('runs in an app with fixtures', async function () {
133
+ let app = await generateApp({
134
+ flags: ['--pnpm', '--typescript'],
135
+ skipNpm: false,
136
+ });
137
+
138
+ fixturify.writeSync(
139
+ app.dir,
140
+ fixturify.readSync('./tests/fixtures/tests-ts-10'),
141
+ );
142
+
143
+ let { stdout: stdout2, exitCode: exitCode2 } = await app.execa('pnpm', [
144
+ 'test',
145
+ ]);
146
+
147
+ if (!process.env.CI) {
148
+ console.log(stdout2);
149
+ }
150
+
151
+ expect(stdout2).to.match(/ok .* Acceptance \| app route/);
152
+ expect(stdout2).to.match(/ok .* Acceptance \| index/);
153
+ expect(stdout2).to.match(/ok .* Integration \| Component \| sweet/);
154
+ expect(stdout2).to.match(/ok .* Unit \| Route \| fancy/);
155
+ expect(stdout2).to.match(/ok .* Ember.onerror/);
156
+
157
+ expect(stdout2).to.contain('# tests 6');
158
+ expect(stdout2).to.contain('# pass 6');
159
+ expect(stdout2).to.contain('# skip 0');
160
+ expect(stdout2).to.contain('# todo 0');
161
+ expect(stdout2).to.contain('# ok');
162
+ expect(exitCode2).to.equal(0);
163
+ });
164
+
165
+ it('runs when serving /tests', async function () {
166
+ let app = await generateApp({
167
+ flags: ['--pnpm', '--typescript'],
168
+ skipNpm: false,
169
+ });
170
+
171
+ await app.execa('pnpm', ['install', '--save-dev', 'testem', 'http-proxy']);
172
+
173
+ let fixtures = fixturify.readSync('./tests/fixtures/tests-js-20');
174
+ let server;
175
+
176
+ try {
177
+ server = app.execa('pnpm', ['start']);
178
+
179
+ let appURL = await new Promise((resolve) => {
180
+ // Read app url from Vite server output
181
+ server.stdout.on('data', (line) => {
182
+ let parsed = stripAnsi(line.toString());
183
+ let result = /Local:\s+(https?:\/\/.*)\//g.exec(parsed);
184
+
185
+ if (process.env.CI) {
186
+ console.log(parsed);
187
+ }
188
+
189
+ if (result) {
190
+ resolve(result[1]);
191
+ }
192
+ });
193
+ });
194
+
195
+ fixtures['testem-dev.js'] = fixtures['testem-dev.js'].replace(
196
+ '%APP_URL%',
197
+ appURL,
198
+ );
199
+ fixturify.writeSync(app.dir, fixtures);
200
+
201
+ let testResult = await app.execa('pnpm', [
202
+ 'testem',
203
+ '--file',
204
+ 'testem-dev.js',
205
+ 'ci',
206
+ ]);
207
+
208
+ if (process.env.CI) {
209
+ console.log(testResult.stdout);
210
+ console.log(testResult.stderr);
211
+ }
212
+
213
+ expect(testResult.exitCode).to.eq(0);
214
+ } finally {
215
+ server?.kill('SIGKILL');
216
+ }
217
+ });
218
+ });
package/vitest.config.ts CHANGED
@@ -4,7 +4,7 @@ const ONE_SECOND = 1_000;
4
4
 
5
5
  export default defineConfig({
6
6
  test: {
7
- testTimeout: 100 * ONE_SECOND,
8
- hookTimeout: 150 * ONE_SECOND,
7
+ testTimeout: 240 * ONE_SECOND,
8
+ hookTimeout: 240 * ONE_SECOND,
9
9
  },
10
10
  });