Files
test-repo/tests_integration/__tests__/write.js
T
Simon Lydell 58350cbe59 Fix failing test on Travis CI
Chalk disables colors in CI environments, making the test pass locally
but not on Travis CI.

This also makes the snapshot more readable.
2017-09-03 17:02:12 +02:00

30 lines
784 B
JavaScript

"use strict";
const runPrettier = require("../runPrettier");
test("write file with --write + unformated file", () => {
const result = runPrettier("cli/write", ["--write", "unformated.js"]);
expect(result.write).toMatchSnapshot();
expect(result.status).toEqual(0);
});
test("do not write file with --write + formated file", () => {
const result = runPrettier("cli/write", ["--write", "formated.js"]);
expect(result.write).toHaveLength(0);
expect(result.status).toEqual(0);
});
test("do not write file with --write + invalid file", () => {
const result = runPrettier("cli/write", [
"--write",
"invalid.js",
"--no-color"
]);
expect(result.stderr).toMatchSnapshot();
expect(result.write).toHaveLength(0);
expect(result.status).not.toEqual(0);
});