Bundle bin and cli separately (#12306)
This commit is contained in:
1 parent
9f6c005b28
commit
5a50a0d909
8 files changed
+66
-39
No files matched your search
@@ -2,7 +2,6 @@
|
||||
|
||||
const prettier = require("prettier-local");
|
||||
const runPrettier = require("../run-prettier.js");
|
||||
const { isProduction } = require("../env.js");
|
||||
|
||||
describe("show version with --version", () => {
|
||||
runPrettier("cli/with-shebang", ["--version"]).test({
|
||||
@@ -90,30 +89,3 @@ describe("throw error and show usage with something unexpected", () => {
|
||||
status: "non-zero",
|
||||
});
|
||||
});
|
||||
|
||||
test("node version error", async () => {
|
||||
const originalProcessVersion = process.version;
|
||||
let result;
|
||||
|
||||
Object.defineProperty(process, "version", {
|
||||
value: "v8.0.0",
|
||||
writable: false,
|
||||
});
|
||||
try {
|
||||
result = await runPrettier("cli", ["--help"]);
|
||||
} finally {
|
||||
Object.defineProperty(process, "version", {
|
||||
value: originalProcessVersion,
|
||||
writable: false,
|
||||
});
|
||||
}
|
||||
|
||||
expect(result.status).toBe(1);
|
||||
expect(result.stderr).toBe(
|
||||
`prettier requires at least version ${
|
||||
isProduction ? "10.13.0" : "12.17.0"
|
||||
} of Node, please upgrade\n`
|
||||
);
|
||||
expect(result.stdout).toBe("");
|
||||
expect(result.write).toEqual([]);
|
||||
});
|
||||
Reference in new issue
Block a user