Added this.shouldMockFiles check in writeFile method