From 87e2eaa5ef8ec4d651eb181aa8dba49be209da40 Mon Sep 17 00:00:00 2001 From: Enrico Campidoglio Date: Thu, 12 Nov 2020 17:35:11 +0100 Subject: [PATCH] Fixes tests that were failing under Node.js 14.x GitHub has updated the version of Node.js in all hosted virtual environments from 12.x to 14.x (actions/virtual-environments#1953). With this change, a few tests that create empty files on disk stopped working because the `writeFileSync` no longer accepts `Object` as the data argument. The solution was to replace the empty object literal with an empty string. --- __tests__/toolsDirectory.test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/__tests__/toolsDirectory.test.ts b/__tests__/toolsDirectory.test.ts index fa6c154e..423aa8d0 100644 --- a/__tests__/toolsDirectory.test.ts +++ b/__tests__/toolsDirectory.test.ts @@ -56,7 +56,7 @@ describe('When checking whether the directory contains a specific file', () => { beforeAll(() => { fs.mkdirSync(sut.path); - fs.writeFileSync(path.join(sut.path, fileName), {}); + fs.writeFileSync(path.join(sut.path, fileName), ''); }); afterAll(() => { @@ -79,7 +79,7 @@ describe('When checking whether the directory contains a specific file in a subd beforeAll(() => { fs.mkdirSync(subdirectoryPath, { recursive: true }); - fs.writeFileSync(path.join(subdirectoryPath, fileName), {}); + fs.writeFileSync(path.join(subdirectoryPath, fileName), ''); }); afterAll(() => { @@ -101,7 +101,7 @@ describe('When checking whether the directory contains a specific tool on Posix' beforeAll(() => { fs.mkdirSync(sut.path); - fs.writeFileSync(path.join(sut.path, toolName), {}); + fs.writeFileSync(path.join(sut.path, toolName), ''); Platform.isWindows = jest.fn().mockImplementation(() => false); }); @@ -124,7 +124,7 @@ describe('When checking whether the directory contains a specific tool on Window beforeAll(() => { fs.mkdirSync(sut.path); - fs.writeFileSync(path.join(sut.path, `${toolName}.exe`), {}); + fs.writeFileSync(path.join(sut.path, `${toolName}.exe`), ''); Platform.isWindows = jest.fn().mockImplementation(() => true); }); @@ -150,7 +150,7 @@ describe('When checking whether the directory contains a specific version of a t beforeAll(() => { fs.mkdirSync(toolDirectoryPath, { recursive: true }); - fs.writeFileSync(path.join(toolDirectoryPath, packageMetadata), {}); + fs.writeFileSync(path.join(toolDirectoryPath, packageMetadata), ''); }); afterAll(() => {