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

fix: writeFileSync can not write to temp files on macOS 10.15 #4887

Merged
merged 1 commit into from Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/linter.ts
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
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