27 lines
522 B
JavaScript
27 lines
522 B
JavaScript
"use strict";
|
|
|
|
const prettier = require("../../tests_config/require_prettier");
|
|
|
|
let warnings = "";
|
|
|
|
beforeAll(() => {
|
|
jest
|
|
.spyOn(console, "warn")
|
|
.mockImplementation(text => (warnings += text + "\n"));
|
|
});
|
|
|
|
beforeEach(() => {
|
|
warnings = "";
|
|
});
|
|
|
|
afterAll(() => {
|
|
jest.restoreAllMocks();
|
|
});
|
|
|
|
test("API format with deprecated parser should work", () => {
|
|
expect(() =>
|
|
prettier.format("body { color: #131313; }", { parser: "postcss" })
|
|
).not.toThrowError();
|
|
expect(warnings).toMatchSnapshot();
|
|
});
|