diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/cookiecutter.test.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/cookiecutter.test.ts index 7d26bcb20a..0de7d94fda 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/cookiecutter.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/cookiecutter.test.ts @@ -16,6 +16,7 @@ jest.mock('./helpers'); import os from 'os'; +import { resolve as resolvePath } from 'path'; import { createFetchCookiecutterAction } from './cookiecutter'; import { ScmIntegrations } from '@backstage/integration'; import { ConfigReader } from '@backstage/config'; @@ -89,7 +90,10 @@ describe('fetch:cookiecutter', () => { integrations, baseUrl: mockContext.baseUrl, fetchUrl: mockContext.input.url, - outputPath: `${mockContext.workspacePath}/template/{{cookiecutter and 'contents'}}`, + outputPath: resolvePath( + mockContext.workspacePath, + `template/{{cookiecutter and 'contents'}}`, + ), }); }); diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/helpers.test.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/helpers.test.ts index e475764a0b..c1e022b8b9 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/helpers.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/helpers.test.ts @@ -15,8 +15,9 @@ */ jest.mock('fs-extra'); -import fs from 'fs-extra'; +import fs from 'fs-extra'; +import { resolve as resolvePath } from 'path'; import { UrlReader } from '@backstage/backend-common'; import { ConfigReader } from '@backstage/config'; import { ScmIntegrations } from '@backstage/integration'; @@ -77,7 +78,7 @@ describe('fetchContent helper', () => { fetchUrl: 'foo', outputPath: 'somepath', }); - expect(fs.copy).toBeCalledWith('/some/foo', 'somepath'); + expect(fs.copy).toBeCalledWith(resolvePath('/some/foo'), 'somepath'); }); it('should reject if no integration matches location', async () => { diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/plain.test.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/plain.test.ts index 88eeb5997b..97c74d6187 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/plain.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/plain.test.ts @@ -16,6 +16,7 @@ jest.mock('./helpers'); import os from 'os'; +import { resolve as resolvePath } from 'path'; import { getVoidLogger, UrlReader } from '@backstage/backend-common'; import { ConfigReader } from '@backstage/config'; import { ScmIntegrations } from '@backstage/integration'; @@ -76,7 +77,7 @@ describe('fetch:plain', () => { }); expect(fetchContents).toBeCalledWith( expect.objectContaining({ - outputPath: `${mockContext.workspacePath}/lol`, + outputPath: resolvePath(mockContext.workspacePath, 'lol'), fetchUrl: 'https://github.com/backstage/community/tree/main/backstage-community-sessions/assets', }),