Skip to content

Commit

Permalink
@embroider/core/test-support -> @embroider/virtual/test-support (#2140)
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli authored Oct 4, 2024
1 parent 72ee15d commit 89d7d7f
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
16 changes: 8 additions & 8 deletions packages/core/src/module-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,9 @@ export class Resolver {
private handleImplicitTestScripts<R extends ModuleRequest>(request: R): R {
//TODO move the extra forwardslash handling out into the vite plugin
const candidates = [
'@embroider/core/test-support.js',
'/@embroider/core/test-support.js',
'./@embroider/core/test-support.js',
'@embroider/virtual/test-support.js',
'/@embroider/virtual/test-support.js',
'./@embroider/virtual/test-support.js',
];

if (!candidates.includes(request.specifier)) {
Expand All @@ -496,7 +496,7 @@ export class Resolver {
let pkg = this.packageCache.ownerOfFile(request.fromFile);
if (pkg?.root !== this.options.engines[0].root) {
throw new Error(
`bug: found an import of ${request.specifier} in ${request.fromFile}, but this is not the top-level Ember app. The top-level Ember app is the only one that has support for @embroider/core/test-support.js. If you think something should be fixed in Embroider, please open an issue on https:/embroider-build/embroider/issues.`
`bug: found an import of ${request.specifier} in ${request.fromFile}, but this is not the top-level Ember app. The top-level Ember app is the only one that has support for @embroider/virtual/test-support.js. If you think something should be fixed in Embroider, please open an issue on https:/embroider-build/embroider/issues.`
);
}

Expand All @@ -506,9 +506,9 @@ export class Resolver {
private handleTestSupportStyles<R extends ModuleRequest>(request: R): R {
//TODO move the extra forwardslash handling out into the vite plugin
const candidates = [
'@embroider/core/test-support.css',
'/@embroider/core/test-support.css',
'./@embroider/core/test-support.css',
'@embroider/virtual/test-support.css',
'/@embroider/virtual/test-support.css',
'./@embroider/virtual/test-support.css',
];

if (!candidates.includes(request.specifier)) {
Expand All @@ -518,7 +518,7 @@ export class Resolver {
let pkg = this.packageCache.ownerOfFile(request.fromFile);
if (pkg?.root !== this.options.engines[0].root) {
throw new Error(
`bug: found an import of ${request.specifier} in ${request.fromFile}, but this is not the top-level Ember app. The top-level Ember app is the only one that has support for @embroider/core/test-support.css. If you think something should be fixed in Embroider, please open an issue on https:/embroider-build/embroider/issues.`
`bug: found an import of ${request.specifier} in ${request.fromFile}, but this is not the top-level Ember app. The top-level Ember app is the only one that has support for @embroider/virtual/test-support.css. If you think something should be fixed in Embroider, please open an issue on https:/embroider-build/embroider/issues.`
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function resolver(): Plugin {
});
this.emitFile({
type: 'asset',
fileName: '@embroider/core/test-support.js',
fileName: '@embroider/virtual/test-support.js',
source: virtualContent(
resolve(resolverLoader.resolver.options.engines[0].root, '-embroider-test-support.js'),
resolverLoader.resolver
Expand Down
4 changes: 2 additions & 2 deletions tests/addon-template/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<link rel="stylesheet" href="/@embroider/virtual/vendor.css">
<link rel="stylesheet" href="/assets/dummy.css">
<link rel="stylesheet" href="/@embroider/core/test-support.css">
<link rel="stylesheet" href="/@embroider/virtual/test-support.css">

{{content-for "head-footer"}}
{{content-for "test-head-footer"}}
Expand All @@ -29,7 +29,7 @@

<script src="/testem.js" integrity="" data-embroider-ignore></script>
<script src="/@embroider/virtual/vendor.js"></script>
<script src="/@embroider/core/test-support.js"></script>
<script src="/@embroider/virtual/test-support.js"></script>
<script type="module">import "ember-testing";</script>

<script type="module">
Expand Down
4 changes: 2 additions & 2 deletions tests/app-template/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<link rel="stylesheet" href="/@embroider/virtual/vendor.css" />
<link rel="stylesheet" href="/assets/app-template.css" />
<link rel="stylesheet" href="/@embroider/core/test-support.css" />
<link rel="stylesheet" href="/@embroider/virtual/test-support.css" />

{{content-for "head-footer"}} {{content-for "test-head-footer"}}
</head>
Expand All @@ -26,7 +26,7 @@

<script src="/testem.js" integrity="" data-embroider-ignore></script>
<script src="/@embroider/virtual/vendor.js"></script>
<script src="/@embroider/core/test-support.js"></script>
<script src="/@embroider/virtual/test-support.js"></script>
<script type="module">import "ember-testing";</script>

<script type="module">
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/macro-sample-addon/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<link rel="stylesheet" href="/@embroider/virtual/vendor.css">
<link rel="stylesheet" href="/assets/dummy.css">
<link rel="stylesheet" href="/@embroider/core/test-support.css">
<link rel="stylesheet" href="/@embroider/virtual/test-support.css">

{{content-for "head-footer"}}
{{content-for "test-head-footer"}}
Expand All @@ -29,7 +29,7 @@

<script src="/testem.js" integrity="" data-embroider-ignore></script>
<script src="/@embroider/virtual/vendor.js"></script>
<script src="/@embroider/core/test-support.js"></script>
<script src="/@embroider/virtual/test-support.js"></script>
<script type="module">import "ember-testing";</script>

<script type="module">
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/macro-test/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<link rel="stylesheet" href="/@embroider/virtual/vendor.css">
<link rel="stylesheet" href="/assets/app-template.css">
<link rel="stylesheet" href="/@embroider/core/test-support.css">
<link rel="stylesheet" href="/@embroider/virtual/test-support.css">

{{content-for "head-footer"}}
{{content-for "test-head-footer"}}
Expand All @@ -35,7 +35,7 @@
<script src="/@embroider/virtual/vendor.js"></script>
<script src="{{rootURL}}apple.js"></script>
<script src="{{rootURL}}ordered.js"></script>
<script src="/@embroider/core/test-support.js"></script>
<script src="/@embroider/virtual/test-support.js"></script>
<script type="module">import "ember-testing";</script>

<script type="module">
Expand Down
6 changes: 3 additions & 3 deletions tests/scenarios/compat-addon-classic-features-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ appScenarios
assert.equal(result.exitCode, 0, result.output);

assert.true(lstatSync(`${app.dir}/dist/@embroider/virtual/vendor.js`).isFile());
assert.true(lstatSync(`${app.dir}/dist/@embroider/core/test-support.js`).isFile());
assert.true(lstatSync(`${app.dir}/dist/@embroider/virtual/test-support.js`).isFile());
});

test('virtual scripts contents are served in dev mode', async function (assert) {
Expand All @@ -168,7 +168,7 @@ appScenarios
let text = await response.text();
assert.true(!text.includes('<!DOCTYPE html>'));

response = await fetch(`${url}/@embroider/core/test-support.js`);
response = await fetch(`${url}/@embroider/virtual/test-support.js`);
assert.strictEqual(response.status, 200);
// checking the response status 200 is not enough to assert test-support.js is served,
// because when the URL is not recognized, the response contains the index.html
Expand Down Expand Up @@ -244,7 +244,7 @@ appScenarios
let text = await response.text();
assert.true(text.includes('.my-addon-p { color: blue; }'));

response = await fetch(`${url}/@embroider/core/test-support.css?direct`);
response = await fetch(`${url}/@embroider/virtual/test-support.css?direct`);
text = await response.text();
assert.true(text.includes('#qunit-tests'));
} finally {
Expand Down
4 changes: 2 additions & 2 deletions tests/ts-app-template/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<link rel="stylesheet" href="/@embroider/virtual/vendor.css">
<link rel="stylesheet" href="/assets/ts-app-template.css">
<link rel="stylesheet" href="/@embroider/core/test-support.css">
<link rel="stylesheet" href="/@embroider/virtual/test-support.css">

{{content-for "head-footer"}}
{{content-for "test-head-footer"}}
Expand All @@ -29,7 +29,7 @@

<script src="/testem.js" integrity="" data-embroider-ignore></script>
<script src="/@embroider/virtual/vendor.js"></script>
<script src="/@embroider/core/test-support.js"></script>
<script src="/@embroider/virtual/test-support.js"></script>
<script type="module">import "ember-testing";</script>

<script type="module">
Expand Down

0 comments on commit 89d7d7f

Please sign in to comment.