Skip to content

Commit 0ec0334

Browse files
committed
move custom-output-paths test to scenario-tester
1 parent 60d6ce7 commit 0ec0334

7 files changed

Lines changed: 69 additions & 123 deletions

File tree

packages/ember-cli-fastboot/test/fixtures/customized-outputpaths/app/index.html

Lines changed: 0 additions & 25 deletions
This file was deleted.

packages/ember-cli-fastboot/test/fixtures/customized-outputpaths/app/templates/application.hbs

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/ember-cli-fastboot/test/fixtures/customized-outputpaths/config/targets.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/ember-cli-fastboot/test/fixtures/customized-outputpaths/ember-cli-build.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

packages/ember-cli-fastboot/test/package-json-test.js

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import qunit from 'qunit';
2+
import { merge } from 'lodash-es';
3+
4+
import { appScenarios } from './scenarios.mjs';
5+
import path from 'node:path';
6+
import fs from 'fs-extra';
7+
8+
const { module: Qmodule, test } = qunit;
9+
10+
appScenarios
11+
.map('custom-output-paths', (project) => {
12+
merge(project.files, {
13+
'ember-cli-build.js': `var EmberApp = require('ember-cli/lib/broccoli/ember-app');
14+
15+
module.exports = function(defaults) {
16+
var app = new EmberApp(defaults, {
17+
outputPaths: {
18+
app: {
19+
html: 'index.html',
20+
css: {
21+
'app': '/some-assets/path/app.css',
22+
},
23+
js: '/some-assets/path/app-file.js'
24+
},
25+
vendor: {
26+
js: '/some-assets/path/lib.js'
27+
}
28+
}
29+
});
30+
31+
return app.toTree();
32+
};`,
33+
});
34+
35+
project.removeDependency('ember-fetch');
36+
})
37+
.forEachScenario((scenario) => {
38+
Qmodule(scenario.name, function (hooks) {
39+
let app; // PreparedApp
40+
41+
hooks.before(async () => {
42+
app = await scenario.prepare();
43+
const result = await app.execute(`pnpm ember build`);
44+
if (result.exitCode !== 0) {
45+
throw new Error(result.stderr);
46+
}
47+
});
48+
49+
test('respects custom output paths and maps to them in the manifest', function (assert) {
50+
function assertFile(filePath) {
51+
assert.ok(fs.existsSync(path.join(app.dir, 'dist', filePath)));
52+
53+
const stat = fs.statSync(path.join(app.dir, 'dist', filePath));
54+
assert.ok(stat.isFile);
55+
}
56+
57+
let pkg = fs.readJsonSync(path.join(app.dir, 'dist/package.json'));
58+
let manifest = pkg.fastboot.manifest;
59+
60+
assert.ok(manifest.appFiles.includes('some-assets/path/app-file.js'));
61+
manifest.appFiles.forEach(assertFile);
62+
assertFile(manifest.htmlFile);
63+
64+
assert.ok(manifest.vendorFiles.includes('some-assets/path/lib.js'));
65+
manifest.vendorFiles.forEach(assertFile);
66+
});
67+
});
68+
});

test-packages/test-scenarios/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"fake-addon-2": "workspace:*",
2121
"fastboot": "workspace:*",
2222
"fastboot-express-middleware": "workspace:*",
23+
"fs-extra": "^10.0.0",
2324
"globby": "^13.2.2",
2425
"lodash-es": "^4.0.0",
2526
"node-fetch": "^2.0.0",

0 commit comments

Comments
 (0)