From 55b298c52a1b8a9c1c16cae929b864835a270de7 Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Sun, 31 Jan 2021 12:30:01 +0100 Subject: [PATCH] scaffolder: Fix test on windows; incorrect file URL --- .../src/scaffolder/stages/prepare/file.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/prepare/file.test.ts b/plugins/scaffolder-backend/src/scaffolder/stages/prepare/file.test.ts index 36be4d705b..0c94edce42 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/prepare/file.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/stages/prepare/file.test.ts @@ -26,16 +26,17 @@ describe('File preparer', () => { it('prepares templates from a file path', async () => { const logger = getVoidLogger(); const preparer = new FilePreparer(); - const workspacePath = os.platform() === 'win32' ? 'C:\\tmp' : '/tmp'; + const root = os.platform() === 'win32' ? 'C:\\' : '/'; + const workspacePath = path.join(root, 'tmp'); const checkoutPath = path.resolve(workspacePath, 'checkout'); await preparer.prepare({ - url: 'file:///path/to/template', + url: `file:///${root}path/to/template`, logger, workspacePath, }); expect(fs.copy).toHaveBeenCalledWith( - path.join('/path', 'to', 'template'), + path.join(root, 'path', 'to', 'template'), checkoutPath, { recursive: true,