Skip to content

Commit

Permalink
wip TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Mar 12, 2024
1 parent 4798697 commit 00e95a1
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 38 deletions.
22 changes: 2 additions & 20 deletions tests/fixtures/fastboot-app/ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
'use strict';

const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const { prebuild } = require('@embroider/compat');

module.exports = function (defaults) {
let app = new EmberApp(defaults, {});

const Webpack = require('@embroider/webpack').Webpack;
return require('@embroider/compat').compatBuild(app, Webpack, {
skipBabel: [
{
package: 'qunit',
},
],
packagerOptions: {
webpackConfig: {
optimization: {
splitChunks: {
// In these tests we want to guarantee that the lazily imported
// things really get handled lazily by webpack, even if they're too
// small for the optimizer to normally bother with
minSize: 1,
},
},
},
},
});
return prebuild(app);
};
14 changes: 2 additions & 12 deletions tests/scenarios/app-config-environment-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,15 @@ appScenarios
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const { compatBuild } = require('@embroider/compat');
const { prebuild } = require('@embroider/compat');
module.exports = function (defaults) {
const app = new EmberApp(defaults, {
tests: true,
storeConfigInMeta: false,
});
return compatBuild(app, undefined, {
staticAddonTrees: true,
staticAddonTestSupportTrees: true,
staticComponents: true,
staticHelpers: true,
staticModifiers: true,
staticEmberSource: true,
amdCompatibility: {
es: [],
},
});
return prebuild(app);
};
`,
config: {
Expand Down
3 changes: 2 additions & 1 deletion tests/scenarios/glimmer-tracking-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ appScenarios
});

test(`pnpm test`, async function (assert) {
let result = await app.execute('pnpm test');
await app.execute('pnpm build');
let result = await app.execute('pnpm test --dir dist');
assert.equal(result.exitCode, 0, result.output);
});
});
Expand Down
3 changes: 3 additions & 0 deletions tests/scenarios/macro-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ dummyAppScenarios
assert.equal(result.exitCode, 0, result.output);
});

// TODO make the vite-app template still work with a classic build
// alternatively instead of polluting the vite app on disk you have scenario-tester change things
// we could consider this as a script that moves things around
test(`pnpm test EMBROIDER_TEST_SETUP_FORCE=classic`, async function (assert) {
let result = await addon.execute('cross-env EMBROIDER_TEST_SETUP_FORCE=classic pnpm test');
assert.equal(result.exitCode, 0, result.output);
Expand Down
3 changes: 2 additions & 1 deletion tests/scenarios/preprocess-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ appScenarios
Qmodule(scenario.name, function () {
test(`pnpm test`, async function (assert) {
let app: PreparedApp = await scenario.prepare();
let result = await app.execute('node ./node_modules/ember-cli/bin/ember b');
let result = await app.execute('npm run build');
assert.equal(result.exitCode, 0, result.output);
let expectFile = expectFilesAt(app.dir, { qunit: assert });
// TODO find the css in the new output and check its content
expectFile('./dist/assets/app-template.css').matches('body { background: red; }');
});
});
Expand Down
1 change: 1 addition & 0 deletions tests/scenarios/stage1-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const { module: Qmodule, test } = QUnit;

appScenarios
.only('canary')
// TODO set all compat options to false for these tests
.map('stage-1-max-compat', project => {
let addon = baseAddon();

Expand Down
6 changes: 2 additions & 4 deletions tests/scenarios/static-app-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,9 @@ appScenarios
return app.toTree();
}
const { compatBuild, recommendedOptions } = require('@embroider/compat');
const { prebuild, recommendedOptions } = require('@embroider/compat');
const Webpack = require('@embroider/webpack').Webpack;
return compatBuild(app, Webpack, {
...recommendedOptions.optimized,
return prebuild(app, {
packageRules: [
{
package: 'app-template',
Expand Down
5 changes: 5 additions & 0 deletions tests/vite-app/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ module.exports = function (defaults) {
});

return maybeEmbroider(app);

// TODO provide a build from vite that almost does maybeEmbroider
// note: this is to handle ember build and NOT ember serve
// TODO figure out a way to error on ember serve
// return emberBuild(app);
};

0 comments on commit 00e95a1

Please sign in to comment.