Merge pull request #4762 from backstage/rugvip/win

scaffolder-backend: fix action tests on windows
This commit is contained in:
Patrik Oldsberg
2021-03-02 22:04:50 +01:00
committed by GitHub
3 changed files with 10 additions and 4 deletions
@@ -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'}}`,
),
});
});
@@ -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 () => {
@@ -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',
}),