Skip to content

Commit

Permalink
feat(new index.html): pass the test entrypoint from app to rewritten-app
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueCutOfficial committed May 17, 2024
1 parent 693ff92 commit 0ed4657
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 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 @@ -179,7 +179,6 @@ export class CompatAppBuilder {
javascript: this.compatApp.findAppScript(scripts, entrypoint),
styles: this.compatApp.findAppStyles(styles, entrypoint),
implicitScripts: this.compatApp.findVendorScript(scripts, entrypoint),
testJavascript: this.compatApp.findTestScript(scripts),
};
},
};
Expand Down Expand Up @@ -371,13 +370,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 @@ -763,12 +763,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 @@ -79,21 +79,17 @@ export class PreparedEmberHTML {
javascript: Placeholder;
styles: 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.styles = Placeholder.replacing(html.styles);
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.styles, this.implicitScripts, this.testJavascript];
return [this.javascript, this.styles, this.implicitScripts];
}

clear() {
Expand Down

0 comments on commit 0ed4657

Please sign in to comment.