diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b67ebc2d8..bec14ff65 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,9 @@ jobs: - uses: ./.github/actions/setup with: use_lockfile: false + - name: Work around windows short path alias # https://github.com/actions/runner-images/issues/712 + if: runner.os == 'Windows' + run: new-item D:\temp -ItemType Directory; echo "TEMP=D:\temp" >> $env:GITHUB_ENV - name: suite run: ${{ matrix.command }} working-directory: ${{ matrix.dir }} diff --git a/packages/shared-internals/src/paths.ts b/packages/shared-internals/src/paths.ts index 5d5ea6dbe..84797443f 100644 --- a/packages/shared-internals/src/paths.ts +++ b/packages/shared-internals/src/paths.ts @@ -12,7 +12,7 @@ export function explicitRelative(fromDir: string, toFile: string) { if (!isAbsolute(result) && !result.startsWith('.')) { result = './' + result; } - if (isAbsolute(toFile) && result.endsWith(toFile)) { + if (isAbsolute(toFile) && result.split(sep).join('/').endsWith(toFile)) { // this prevents silly "relative" paths like // "../../../../../Users/you/projects/your/stuff" when we could have just // said "/Users/you/projects/your/stuff". The silly path isn't incorrect, diff --git a/tests/scenarios/compat-renaming-test.ts b/tests/scenarios/compat-renaming-test.ts index 70b2c6985..6918e75f0 100644 --- a/tests/scenarios/compat-renaming-test.ts +++ b/tests/scenarios/compat-renaming-test.ts @@ -1,7 +1,6 @@ import type { PreparedApp } from 'scenario-tester'; import { appScenarios, baseAddon } from './scenarios'; import QUnit from 'qunit'; -import { resolve, sep } from 'path'; const { module: Qmodule, test } = QUnit; import type { ExpectFile } from '@embroider/test-support/file-assertions/qunit'; @@ -238,12 +237,12 @@ appScenarios expectAudit .module('./components/import-somebody-elses-original.js') .resolves('somebody-elses-package') - .to(resolve('/@embroider/ext-cjs/somebody-elses-package').split(sep).join('/')); + .to('/@embroider/ext-cjs/somebody-elses-package'); expectAudit .module('./components/import-somebody-elses-original.js') .resolves('somebody-elses-package/deeper') - .to(resolve('/@embroider/ext-cjs/somebody-elses-package/deeper').split(sep).join('/')); + .to('/@embroider/ext-cjs/somebody-elses-package/deeper'); }); test('single file package gets captured and renamed', function () { expectAudit diff --git a/tests/scenarios/core-resolver-test.ts b/tests/scenarios/core-resolver-test.ts index c4fa429a7..cab82f709 100644 --- a/tests/scenarios/core-resolver-test.ts +++ b/tests/scenarios/core-resolver-test.ts @@ -1,6 +1,6 @@ import type { AddonMeta, AppMeta, RewrittenPackageIndex } from '@embroider/shared-internals'; import { outputFileSync, readJsonSync, writeJSONSync } from 'fs-extra'; -import { resolve, sep } from 'path'; +import { resolve } from 'path'; import QUnit from 'qunit'; import type { PreparedApp } from 'scenario-tester'; import { Project, Scenarios } from 'scenario-tester'; @@ -609,7 +609,7 @@ Scenarios.fromProject(() => new Project()) 'app.js': `import "rsvp"`, }); await configure({}); - expectAudit.module('./app.js').resolves('rsvp').to(resolve('/@embroider/ext-cjs/rsvp').split(sep).join('/')); + expectAudit.module('./app.js').resolves('rsvp').to('/@embroider/ext-cjs/rsvp'); }); test(`known ember-source-provided virtual packages are not externalized when explicitly included in deps`, async function () {