Skip to content

Commit

Permalink
Fixes tests that were failing under Node.js 14.x
Browse files Browse the repository at this point in the history
GitHub has updated the version of Node.js in all hosted virtual environments
from 12.x to 14.x (actions/runner-images#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.
  • Loading branch information
ecampidoglio committed Nov 16, 2020
1 parent e58ab48 commit 87e2eaa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions __tests__/toolsDirectory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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(() => {
Expand All @@ -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);
});

Expand All @@ -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);
});

Expand All @@ -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(() => {
Expand Down

0 comments on commit 87e2eaa

Please sign in to comment.