Add a newline character to the output of a file (#196)
All checks were successful
Test / build (push) Successful in 7s
All checks were successful
Test / build (push) Successful in 7s
- Add a newline character at the end of the outputted file contents - This is so it follows POSIX convention #80 Reviewed-on: #196 Reviewed-by: VylpesTester <tester@vylpes.com> Co-authored-by: Ethan Lane <ethan@vylpes.com> Co-committed-by: Ethan Lane <ethan@vylpes.com>
This commit is contained in:
parent
7c9411b4e2
commit
56c886862c
2 changed files with 2 additions and 2 deletions
|
@ -9,7 +9,7 @@ export default class CliHelper {
|
||||||
const output = OutputHelper.GenerateOutput(response, options);
|
const output = OutputHelper.GenerateOutput(response, options);
|
||||||
|
|
||||||
if (options.o) {
|
if (options.o) {
|
||||||
writeFileSync(options.o, output);
|
writeFileSync(options.o, `${output}\n`);
|
||||||
} else {
|
} else {
|
||||||
console.log(output);
|
console.log(output);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ describe("Endpoint", () => {
|
||||||
expect(OutputHelper.GenerateOutput).toHaveBeenCalledWith(response, options);
|
expect(OutputHelper.GenerateOutput).toHaveBeenCalledWith(response, options);
|
||||||
|
|
||||||
expect(fs.writeFileSync).toHaveBeenCalledTimes(1);
|
expect(fs.writeFileSync).toHaveBeenCalledTimes(1);
|
||||||
expect(fs.writeFileSync).toHaveBeenCalledWith("file.txt", "test output");
|
expect(fs.writeFileSync).toHaveBeenCalledWith("file.txt", "test output\n");
|
||||||
|
|
||||||
expect(console.log).not.toHaveBeenCalled();
|
expect(console.log).not.toHaveBeenCalled();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue