Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
fix: writeFileSync can not write to temp files on macOS 10.15 (#4887)
Browse files Browse the repository at this point in the history
  • Loading branch information
i1skn authored and Josh Goldberg committed Nov 6, 2019
1 parent ced5ed2 commit 8c2ac95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export class Linter {
const oldSource = fs.readFileSync(filePath, "utf-8");
fileNewSource = Replacement.applyFixes(oldSource, fileFixes);
}
fs.writeFileSync(filePath, fileNewSource);
fs.writeFileSync(path.resolve(filePath), fileNewSource);
this.updateProgram(filePath);
});

Expand Down
4 changes: 2 additions & 2 deletions test/executable/executableTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ describe("Executable", function(this: Mocha.Suite) {
it("fixes multiple rules without overwriting each other", async () => {
const tempFile = path.relative(process.cwd(), createTempFile("ts"));
fs.writeFileSync(
tempFile,
path.resolve(tempFile),
'import * as x from "b"\nimport * as y from "a_long_module";\n',
);
const result = await execRunnerWithOutput({
Expand All @@ -348,7 +348,7 @@ describe("Executable", function(this: Mocha.Suite) {
const content = fs.readFileSync(tempFile, "utf8");
// compare against file name which will be returned by formatter (used in TypeScript)
const denormalizedFileName = denormalizeWinPath(tempFile);
fs.unlinkSync(tempFile);
fs.unlinkSync(path.resolve(tempFile));
assert.equal(result.status, Status.Ok, "process should exit without an error");
assert.strictEqual(
content,
Expand Down

0 comments on commit 8c2ac95

Please sign in to comment.