Skip to content

Commit

Permalink
Merge pull request #1926 from embroider-build/new-index-html-format-t…
Browse files Browse the repository at this point in the history
…est-entrypoint

New `index.html`- format test-entrypoint
  • Loading branch information
mansona authored May 20, 2024
2 parents e01da0a + 1f8b749 commit 2f2e854
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 24 deletions.
8 changes: 0 additions & 8 deletions packages/compat/src/compat-app-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ export class CompatAppBuilder {
return {
javascript: this.compatApp.findAppScript(scripts, entrypoint),
implicitScripts: this.compatApp.findVendorScript(scripts, entrypoint),
testJavascript: this.compatApp.findTestScript(scripts),
};
},
};
Expand Down Expand Up @@ -367,13 +366,6 @@ export class CompatAppBuilder {
html.insertScriptTag(html.implicitScripts, script, { tag: 'fastboot-script' });
}
}

if (!asset.fileAsset.includeTests) {
return;
}

// Test-related assets happen below this point
html.insertScriptTag(html.javascript, '@embroider/core/test-entrypoint', { type: 'module' });
}

// recurse to find all active addons that don't cross an engine boundary.
Expand Down
6 changes: 0 additions & 6 deletions packages/compat/src/compat-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -750,12 +750,6 @@ export default class CompatApp {
);
}

findTestScript(scripts: HTMLScriptElement[]): HTMLScriptElement | undefined {
return scripts.find(
script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.tests.js
);
}

readonly macrosConfig: MacrosConfig;

constructor(readonly legacyEmberAppInstance: EmberAppInstance, _options?: Options) {
Expand Down
6 changes: 1 addition & 5 deletions packages/core/src/ember-html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,16 @@ export class PreparedEmberHTML {
dom: JSDOM;
javascript: Placeholder;
implicitScripts: Placeholder;
testJavascript: Placeholder;

constructor(private asset: EmberAsset) {
this.dom = new JSDOM(readFileSync(asset.sourcePath, 'utf8'));
let html = asset.prepare(this.dom);
this.javascript = Placeholder.find(html.javascript);
this.implicitScripts = Placeholder.find(html.implicitScripts);
this.testJavascript = html.testJavascript
? Placeholder.replacing(html.testJavascript)
: Placeholder.immediatelyAfter(this.javascript.end);
}

private placeholders(): Placeholder[] {
return [this.javascript, this.implicitScripts, this.testJavascript];
return [this.javascript, this.implicitScripts];
}

clear() {
Expand Down
2 changes: 1 addition & 1 deletion test-packages/sample-transforms/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<script src="/@embroider/core/vendor.js"></script>
<script src="/@embroider/core/test-support.js"></script>
<script src="/@embroider/core/entrypoint" type="module"></script>
<script src="{{rootURL}}assets/tests.js"></script>
<script src="/@embroider/core/test-entrypoint" type="module"></script>

{{content-for "body-footer"}}
{{content-for "test-body-footer"}}
Expand Down
2 changes: 1 addition & 1 deletion tests/addon-template/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<script src="/@embroider/core/vendor.js"></script>
<script src="/@embroider/core/test-support.js"></script>
<script src="/@embroider/core/entrypoint" type="module"></script>
<script src="{{rootURL}}assets/tests.js"></script>
<script src="/@embroider/core/test-entrypoint" type="module"></script>

{{content-for "body-footer"}}
{{content-for "test-body-footer"}}
Expand Down
2 changes: 1 addition & 1 deletion tests/app-template/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<script src="/@embroider/core/vendor.js"></script>
<script src="/@embroider/core/test-support.js"></script>
<script src="/@embroider/core/entrypoint" type="module"></script>
<script src="{{rootURL}}assets/tests.js"></script>
<script src="/@embroider/core/test-entrypoint" type="module"></script>

{{content-for "body-footer"}} {{content-for "test-body-footer"}}
</body>
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/macro-test/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<script src="{{rootURL}}ordered.js"></script>
<script src="/@embroider/core/test-support.js"></script>
<script src="/@embroider/core/entrypoint" type="module"></script>
<script src="{{rootURL}}assets/tests.js"></script>
<script src="/@embroider/core/test-entrypoint" type="module"></script>

{{content-for "body-footer"}}
{{content-for "test-body-footer"}}
Expand Down
2 changes: 1 addition & 1 deletion tests/ts-app-template/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<script src="/@embroider/core/vendor.js"></script>
<script src="/@embroider/core/test-support.js"></script>
<script src="/@embroider/core/entrypoint" type="module"></script>
<script src="{{rootURL}}assets/tests.js"></script>
<script src="/@embroider/core/test-entrypoint" type="module"></script>

{{content-for "body-footer"}}
{{content-for "test-body-footer"}}
Expand Down

0 comments on commit 2f2e854

Please sign in to comment.