Also infer parser when using `--list-different` (#1997)
* Also infer parser when using `--list-different` * Add integration tests for parser inferencemaster
parent
df7311a7f3
commit
d679f235ed
|
@ -299,7 +299,12 @@ if (stdin) {
|
|||
}
|
||||
|
||||
if (argv["list-different"]) {
|
||||
if (!prettier.check(input, options)) {
|
||||
if (
|
||||
!prettier.check(
|
||||
input,
|
||||
Object.assign({}, options, { filepath: filename })
|
||||
)
|
||||
) {
|
||||
if (!write) {
|
||||
console.log(filename);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`infers postcss parser 1`] = `
|
||||
"/* JavaScript */
|
||||
\\"use strict\\";
|
||||
/* Stylesheet */
|
||||
* {
|
||||
outline: none;
|
||||
}
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`infers postcss parser with --list-different 1`] = `""`;
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
|
||||
const runPrettier = require("../runPrettier");
|
||||
|
||||
test("infers postcss parser", () => {
|
||||
const result = runPrettier("cli/with-parser-inference", ["*"]);
|
||||
|
||||
expect(result.stdout).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test("infers postcss parser with --list-different", () => {
|
||||
const result = runPrettier("cli/with-parser-inference", [
|
||||
"--list-different",
|
||||
"*"
|
||||
]);
|
||||
|
||||
expect(result.stdout).toMatchSnapshot();
|
||||
});
|
|
@ -0,0 +1,2 @@
|
|||
/* JavaScript */
|
||||
"use strict";
|
|
@ -0,0 +1,4 @@
|
|||
/* Stylesheet */
|
||||
* {
|
||||
outline: none;
|
||||
}
|
Loading…
Reference in New Issue