@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.
- package/.github/workflows/{plan-release.yml → plan-stable-release.yml} +5 -6
- package/.github/workflows/{publish.yml → publish-stable.yml} +2 -3
- package/.prettierignore +1 -2
- package/.release-plan.json +4 -4
- package/CHANGELOG.md +47 -0
- package/README.md +10 -0
- package/eslint.config.mjs +1 -5
- package/files/package.json +43 -43
- package/package.json +2 -2
- package/tests/arguments.test.mjs +155 -0
- package/tests/fixtures/tests-js-10/app/components/.gitkeep +0 -0
- package/tests/fixtures/tests-js-10/app/components/sweet.gjs +3 -0
- package/tests/{fixture → fixtures/tests-js-10}/app/router.js +2 -3
- package/tests/fixtures/tests-js-10/app/routes/.gitkeep +0 -0
- package/tests/{fixture/app/routes/styles.js → fixtures/tests-js-10/app/routes/fancy.js} +1 -1
- package/tests/fixtures/tests-js-10/app/styles/app.css +3 -0
- package/tests/fixtures/tests-js-10/app/templates/application.gjs +15 -0
- package/tests/fixtures/tests-js-10/app/templates/fancy.gjs +12 -0
- package/tests/fixtures/tests-js-10/tests/acceptance/index-test.js +26 -0
- package/tests/fixtures/tests-js-10/tests/integration/components/sweet-test.gjs +28 -0
- package/tests/fixtures/tests-js-10/tests/routes/fancy-test.js +11 -0
- package/tests/{fixture-ts/testem-proxy.js → fixtures/tests-js-20/testem-dev.js} +26 -2
- package/tests/fixtures/tests-ts-10/app/components/.gitkeep +0 -0
- package/tests/fixtures/tests-ts-10/app/components/sweet.gts +3 -0
- package/tests/{fixture-ts → fixtures/tests-ts-10}/app/router.ts +2 -3
- package/tests/fixtures/tests-ts-10/app/routes/.gitkeep +0 -0
- package/tests/{fixture-ts/app/routes/styles.ts → fixtures/tests-ts-10/app/routes/fancy.ts} +1 -1
- package/tests/fixtures/tests-ts-10/app/styles/app.css +3 -0
- package/tests/fixtures/tests-ts-10/app/templates/application.gts +15 -0
- package/tests/fixtures/tests-ts-10/app/templates/fancy.gts +12 -0
- package/tests/fixtures/tests-ts-10/tests/acceptance/index-test.ts +26 -0
- package/tests/fixtures/tests-ts-10/tests/integration/components/sweet-test.gjs +28 -0
- package/tests/fixtures/tests-ts-10/tests/routes/fancy-test.js +11 -0
- package/tests/generators.test.mjs +60 -0
- package/tests/helpers.mjs +26 -91
- package/tests/lint.test.mjs +27 -10
- package/tests/tests.test.mjs +218 -0
- package/vitest.config.ts +2 -2
- package/tests/default.test.mjs +0 -155
- package/tests/fixture/app/components/custom-component.hbs +0 -3
- package/tests/fixture/app/styles/app.css +0 -5
- package/tests/fixture/app/templates/application.hbs +0 -3
- package/tests/fixture/app/templates/custom-component.hbs +0 -1
- package/tests/fixture/app/templates/index.hbs +0 -1
- package/tests/fixture/app/templates/styles.hbs +0 -5
- package/tests/fixture/testem-proxy.js +0 -35
- package/tests/fixture/tests/acceptance/custom-component-test.js +0 -14
- package/tests/fixture/tests/acceptance/styles-test.js +0 -18
- package/tests/fixture-ts/app/styles/app.css +0 -5
- package/tests/fixture-ts/app/templates/components/custom.gts +0 -5
- package/tests/fixture-ts/app/templates/custom-component.gts +0 -5
- package/tests/fixture-ts/app/templates/index.gts +0 -5
- package/tests/fixture-ts/app/templates/styles.gts +0 -7
- package/tests/fixture-ts/tests/acceptance/custom-component-test.ts +0 -14
- package/tests/fixture-ts/tests/acceptance/styles-test.ts +0 -18
- package/tests/typescript.test.mjs +0 -24
- /package/tests/{fixture → fixtures/tests-js-10}/app/initializers/test-init.js +0 -0
- /package/tests/{fixture → fixtures/tests-js-10}/app/instance-initializers/test-instance-init.js +0 -0
- /package/tests/{fixture → fixtures/tests-js-10}/tests/acceptance/app-init-test.js +0 -0
- /package/tests/{fixture → fixtures/tests-js-10}/tests/acceptance/welcome-page-test.js +0 -0
- /package/tests/{fixture-ts → fixtures/tests-ts-10}/app/initializers/test-init.ts +0 -0
- /package/tests/{fixture-ts → fixtures/tests-ts-10}/app/instance-initializers/test-instance-init.ts +0 -0
- /package/tests/{fixture-ts → fixtures/tests-ts-10}/tests/acceptance/app-init-test.ts +0 -0
- /package/tests/{fixture-ts → fixtures/tests-ts-10}/tests/acceptance/welcome-page-test.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import EmberRouter from '@
|
|
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('
|
|
11
|
-
this.route('custom-component');
|
|
10
|
+
this.route('fancy');
|
|
12
11
|
});
|
|
File without changes
|
|
@@ -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,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
|
|
15
|
-
|
|
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
|
-
|
|
49
|
-
packageJson = {},
|
|
50
|
-
name = appName,
|
|
12
|
+
skipNpm = true,
|
|
51
13
|
} = {}) {
|
|
52
|
-
|
|
14
|
+
const tmpDir = (await tmp.dir()).path;
|
|
15
|
+
const dir = join(tmpDir, name);
|
|
53
16
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
64
|
-
|
|
21
|
+
const execaOptions = {
|
|
22
|
+
cwd: tmpDir,
|
|
23
|
+
};
|
|
65
24
|
|
|
66
|
-
|
|
25
|
+
if (!process.env.CI) {
|
|
26
|
+
execaOptions.stdio = 'inherit';
|
|
27
|
+
}
|
|
67
28
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
}
|
package/tests/lint.test.mjs
CHANGED
|
@@ -1,26 +1,43 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
1
|
+
import { beforeAll, describe, it, expect } from 'vitest';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { generateApp } from './helpers.mjs';
|
|
4
4
|
|
|
5
5
|
describe('linting & formatting', function () {
|
|
6
|
-
|
|
7
|
-
let project = newProject();
|
|
6
|
+
let app;
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
18
|
-
|
|
21
|
+
let app;
|
|
22
|
+
|
|
23
|
+
beforeAll(async function () {
|
|
24
|
+
app = await generateApp({ flags: ['--typescript'], skipNpm: false });
|
|
19
25
|
});
|
|
20
26
|
|
|
21
|
-
it('yields output
|
|
22
|
-
let { exitCode } = await
|
|
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
|
+
});
|