Skip to content

Commit

Permalink
fix: Don't remove local.settings.json in offline cleanup (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbarlow12 authored and mydiemho committed Aug 28, 2019
1 parent 5815a2f commit 9cc06b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
6 changes: 2 additions & 4 deletions src/services/offlineService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ describe("Offline Service", () => {
MockFactory.createTestBindingsObject(`..${path.sep}${name}.js`)
);
}
expect(calls[calls.length - 1][0]).toEqual("local.settings.json");
writeFileSpy.mockRestore();
});

Expand Down Expand Up @@ -80,9 +79,9 @@ describe("Offline Service", () => {
const rmdirSpy = jest.spyOn(fs, "rmdirSync")
await service.cleanup();
const unlinkCalls = unlinkSpy.mock.calls;
expect(unlinkCalls).toHaveLength(2);
expect(unlinkCalls[0][0]).toBe(`hello${path.sep}function.json`);
expect(unlinkCalls[1][0]).toBe(`goodbye${path.sep}function.json`);
expect(unlinkCalls[2][0]).toBe("local.settings.json");
const rmdirCalls = rmdirSpy.mock.calls;
expect(rmdirCalls[0][0]).toBe("hello");
expect(rmdirCalls[1][0]).toBe("goodbye");
Expand Down Expand Up @@ -193,10 +192,9 @@ describe("Offline Service", () => {

const unlinkCalls = unlinkSpy.mock.calls;

expect(unlinkCalls).toHaveLength(3);
expect(unlinkCalls).toHaveLength(2);
expect(unlinkCalls[0][0]).toBe(`hello${path.sep}function.json`);
expect(unlinkCalls[1][0]).toBe(`goodbye${path.sep}function.json`);
expect(unlinkCalls[2][0]).toBe("local.settings.json");

const rmdirCalls = rmdirSpy.mock.calls;

Expand Down
7 changes: 0 additions & 7 deletions src/services/offlineService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ export class OfflineService extends BaseService {
public async cleanup() {
this.log("Cleaning up offline files")
await this.packageService.cleanUp();
const filenames = Object.keys(this.localFiles);
for (const filename of filenames) {
if (fs.existsSync(filename)) {
this.log(`Removing file '${filename}'`);
fs.unlinkSync(filename)
}
}
this.log("Finished cleaning up offline files");
}

Expand Down

0 comments on commit 9cc06b5

Please sign in to comment.