Test empty files with snippets (#8116)

* Test empty files with `snippets`
* Assert output
This commit is contained in:
fisker Cheung authored and GitHub committed 2020-05-04 18:27:15 +08:00
1 parent 69d5c55da9
commit 208eaad44e
6 files changed
+38 -62

No files matched your search

@@ -1,52 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`empty format 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "babel-flow", "babel-ts", "typescript", "css", "less", "scss", "json", "json5", "json-stringify", "graphql", "markdown", "mdx", "vue", "yaml", "html", "angular", "lwc"]
printWidth: 80
| printWidth
=====================================input======================================
=====================================output=====================================
================================================================================
`;
exports[`newline format 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "babel-flow", "babel-ts", "typescript", "css", "less", "scss", "json", "json5", "json-stringify", "graphql", "markdown", "mdx", "vue", "yaml", "html", "angular", "lwc"]
printWidth: 80
| printWidth
=====================================input======================================
=====================================output=====================================
================================================================================
`;
exports[`space format 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "babel-flow", "babel-ts", "typescript", "css", "less", "scss", "json", "json5", "json-stringify", "graphql", "markdown", "mdx", "vue", "yaml", "html", "angular", "lwc"]
printWidth: 80
| printWidth
=====================================input======================================
=====================================output=====================================
================================================================================
`;
exports[`space-newline format 1`] = `
====================================options=====================================
parsers: ["flow", "babel", "babel-flow", "babel-ts", "typescript", "css", "less", "scss", "json", "json5", "json-stringify", "graphql", "markdown", "mdx", "vue", "yaml", "html", "angular", "lwc"]
printWidth: 80
| printWidth
=====================================input======================================
=====================================output=====================================
================================================================================
`;
View File
Whitespace-only changes.
+38 -7
View File
@@ -1,11 +1,42 @@
const prettier = require("prettier/local");
const parsers = prettier
const parsers = require("prettier/local")
.getSupportInfo()
.options.find((option) => option.name === "parser");
.options.find((option) => option.name === "parser")
.choices.filter((choice) => !choice.deprecated)
.map((choice) => choice.value);
run_spec(
__dirname,
parsers.choices
.filter((choice) => !choice.deprecated)
.map((choice) => choice.value)
{
dirname: __dirname,
snippets: [
// empty
"",
// space
" ",
" ",
// `\n`
"\n",
" \n",
" \n ",
"\n\n\n\n",
" \n \n \n\n",
" \n \n \n\n ",
// `\r`
"\r",
" \r",
" \r ",
"\r\r\r\r",
" \r \r \r\r",
" \r \r \r\r ",
// `\r\n`
"\r\n",
" \r\n",
" \r\n ",
"\r\n\r\n\r\n\r\n",
" \r\n \r\n \r\n\r\n",
" \r\n \r\n \r\n\r\n ",
// mixed `\r` `\r\n` '\n'
" \r \r\n \n ",
].map((code) => ({ code, output: "" })),
},
parsers
);
-1
View File
@@ -1 +0,0 @@
-1
View File
@@ -1 +0,0 @@
-1
View File
@@ -1 +0,0 @@