Skip to content

Commit

Permalink
fix colocation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Mar 21, 2024
1 parent d65f8d9 commit 6fb2058
Showing 1 changed file with 6 additions and 29 deletions.
35 changes: 6 additions & 29 deletions tests/scenarios/compat-template-colocation-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ scenarios
let app = new EmberApp(defaults, {});
return prebuild(app, {
staticComponents: false,
staticAddonTrees: false,
});
};
`,
Expand Down Expand Up @@ -132,22 +133,10 @@ scenarios
test(`app's colocated components are implicitly included correctly`, function () {
expectAudit
.module('./node_modules/.embroider/rewritten-app/index.html')
.resolves('./@embroider/core/entrypoint')
.toModule()
.withContents(content => {
console.log(content);
const importMatches =
/import \* as (amdModule\d+) from "@embroider-dep\/my-app\/components\/has-colocated-template\.js"/.exec(
content
);

const defineMatch =
/d\("my-app\/components\/has-colocated-template", function\s*\(\)\s*\{\s*return (amdModule\d+);\s*\}/.exec(
content
);

return Boolean(importMatches && defineMatch && importMatches[1] === defineMatch[1]);
});
.resolves('./assets/my-app.js')
.toModule().codeContains(`d("my-app/components/has-colocated-template", function () {
return i("my-app/components/has-colocated-template.js");
});`);
});

test(`addon's colocated template is associated with JS`, function () {
Expand Down Expand Up @@ -182,19 +171,7 @@ scenarios
});

scenarios
.map('staticComponents-true', app => {
merge(app.files, {
'ember-cli-build.js': `
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const { prebuild } = require('@embroider/test-setup');
module.exports = function (defaults) {
let app = new EmberApp(defaults, {});
return prebuild(app);
};
`,
});
})
.map('staticComponents-true', () => {})
.forEachScenario(scenario => {
Qmodule(scenario.name, function (hooks) {
throwOnWarnings(hooks);
Expand Down

0 comments on commit 6fb2058

Please sign in to comment.