Add a single test suite for blank files in all parsers (#4562)

* Add a single test suite for blank files in all parsers

The parsers that don’t yet support blank files have been filtered out of the list until they do.

* Don’t directly `require()` Prettier

* Update `require`

* Add missing Babylon parser

* Update snapshots
master
Jed Fox 2018-05-27 08:22:25 -04:00 committed by GitHub
parent b0cb63a7bb
commit a1e8d586ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 43 additions and 35 deletions

View File

@ -1,11 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`empty-file.css 1`] = `
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`;
exports[`single-space.css 1`] = `
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`;

View File

@ -1 +0,0 @@
run_spec(__dirname, ["css"]);

View File

@ -1 +0,0 @@

View File

@ -1,18 +1,24 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`empty.js 1`] = `
;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`;
exports[`empty-file.js 1`] = `
exports[`empty 1`] = `
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`;
exports[`single-space.js 1`] = `
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exports[`newline 1`] = `
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`;
exports[`space 1`] = `
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`;
exports[`space-newline 1`] = `
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`;

View File

@ -1 +1,15 @@
run_spec(__dirname, ["flow", "typescript"]);
const prettier = require("prettier/local");
const parsers = prettier
.getSupportInfo()
.options.find(option => option.name === "parser");
run_spec(
__dirname,
parsers.choices
.filter(choice => !choice.deprecated)
.map(choice => choice.value)
.filter(
parser =>
["json", "json5", "json-stringify", "graphql"].indexOf(parser) === -1
)
);

1
tests/empty/newline Normal file
View File

@ -0,0 +1 @@

View File

@ -1 +0,0 @@

1
tests/empty/space Normal file
View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`semicolon.js 1`] = `
;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`;

View File

@ -0,0 +1 @@
run_spec(__dirname, ["babylon", "flow", "typescript"]);

View File

@ -1,15 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`empty.md 1`] = `
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`;
exports[`empty.md 2`] = `
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`;
exports[`real-world-case.md 1`] = `
# Prettier