Do not throw on an empty file with a ; (#1503)
Fixes "TypeError: Cannot read property 'replace' of undefined" This was discovered by #1480 and also affects non-typescriptmaster
parent
e6eee0467d
commit
bdf6050434
|
@ -284,10 +284,12 @@ function printDocToString(doc, options) {
|
|||
out.pop();
|
||||
}
|
||||
|
||||
out[out.length - 1] = out[out.length - 1].replace(
|
||||
/[^\S\n]*$/,
|
||||
""
|
||||
);
|
||||
if (out.length) {
|
||||
out[out.length - 1] = out[out.length - 1].replace(
|
||||
/[^\S\n]*$/,
|
||||
""
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let length = ind.indent * options.tabWidth + ind.align.spaces;
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`empty.js 1`] = `
|
||||
;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
`;
|
|
@ -0,0 +1 @@
|
|||
;
|
|
@ -0,0 +1 @@
|
|||
run_spec(__dirname);
|
Loading…
Reference in New Issue