Skip to content

Commit

Permalink
more windows test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ef4 committed Dec 16, 2024
1 parent 8da9579 commit ac29389
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions tests/scenarios/core-resolver-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ Scenarios.fromProject(() => new Project())

pairModule.codeEquals(`
import { setComponentTemplate } from "@ember/component";
import template from "${templateFile}";
import template from "${esc(templateFile)}";
import { deprecate } from "@ember/debug";
true && !false && deprecate(
"Components with separately resolved templates are deprecated. Migrate to either co-located js/ts + hbs files or to gjs/gts. Tried to lookup 'hello-world'.",
Expand All @@ -261,7 +261,7 @@ Scenarios.fromProject(() => new Project())
},
}
);
import component from "${componentFile}";
import component from "${esc(componentFile)}";
export default setComponentTemplate(template, component);
`);

Expand All @@ -285,7 +285,7 @@ Scenarios.fromProject(() => new Project())
let templateFile = normalizePath(`${app.dir}/templates/components/hello-world.hbs`);
pairModule.codeEquals(`
import { setComponentTemplate } from "@ember/component";
import template from "${templateFile}";
import template from "${esc(templateFile)}";
import { deprecate } from "@ember/debug";
true && !false && deprecate(
"Components with separately resolved templates are deprecated. Migrate to either co-located js/ts + hbs files or to gjs/gts. Tried to lookup 'hello-world'.",
Expand Down Expand Up @@ -400,7 +400,7 @@ Scenarios.fromProject(() => new Project())

pairModule.codeEquals(`
import { setComponentTemplate } from "@ember/component";
import template from "${templateFile}";
import template from "${esc(templateFile)}";
import { deprecate } from "@ember/debug";
true && !false && deprecate(
"Components with separately resolved templates are deprecated. Migrate to either co-located js/ts + hbs files or to gjs/gts. Tried to lookup 'template'.",
Expand Down Expand Up @@ -440,7 +440,7 @@ Scenarios.fromProject(() => new Project())

pairModule.codeEquals(`
import { setComponentTemplate } from "@ember/component";
import template from "${templateFile}";
import template from "${esc(templateFile)}";
import { deprecate } from "@ember/debug";
true && !false && deprecate(
"Components with separately resolved templates are deprecated. Migrate to either co-located js/ts + hbs files or to gjs/gts. Tried to lookup 'template'.",
Expand Down Expand Up @@ -482,7 +482,7 @@ Scenarios.fromProject(() => new Project())

pairModule.codeEquals(`
import { setComponentTemplate } from "@ember/component";
import template from "${templateFile}";
import template from "${esc(templateFile)}";
import { deprecate } from "@ember/debug";
true && !false && deprecate(
"Components with separately resolved templates are deprecated. Migrate to either co-located js/ts + hbs files or to gjs/gts. Tried to lookup 'template'.",
Expand All @@ -498,7 +498,7 @@ Scenarios.fromProject(() => new Project())
},
}
);
import component from "${componentFile}";
import component from "${esc(componentFile)}";
export default setComponentTemplate(template, component);
`);

Expand All @@ -525,7 +525,7 @@ Scenarios.fromProject(() => new Project())

pairModule.codeEquals(`
import { setComponentTemplate } from "@ember/component";
import template from "${templateFile}";
import template from "${esc(templateFile)}";
import { deprecate } from "@ember/debug";
true && !false && deprecate(
"Components with separately resolved templates are deprecated. Migrate to either co-located js/ts + hbs files or to gjs/gts. Tried to lookup 'template'.",
Expand All @@ -541,7 +541,7 @@ Scenarios.fromProject(() => new Project())
},
}
);
import component from "${componentFile}";
import component from "${esc(componentFile)}";
export default setComponentTemplate(template, component);
`);
pairModule.resolves(templateFile).to('./pods/components/hello-world/template.hbs');
Expand Down Expand Up @@ -1003,8 +1003,12 @@ Scenarios.fromProject(() => new Project())

function normalizePath(s: string): string {
if (process.platform === 'win32') {
return s.replace('/', '\\');
return s.replace(/\//g, '\\');
} else {
return s;
}
}

function esc(s: string): string {
return s.replace(/\\/g, '\\\\');
}

0 comments on commit ac29389

Please sign in to comment.