Integration test: Rename runPrettier to runCli (#14687)

This commit is contained in:
fisker Cheung authored and GitHub committed 2023-04-11 08:44:23 +08:00
1 parent 578f093d30
commit fb948bb15f
54 files changed
+359 -433

No files matched your search

@@ -3,7 +3,7 @@
const selector = [
"CallExpression",
'[callee.type="Identifier"]',
'[callee.name="runPrettier"]',
'[callee.name="runCli"]',
].join("");
const MESSAGE_ID_CALL = "await-cli-tests/call";
@@ -16,9 +16,8 @@ module.exports = {
url: "https://github.com/prettier/prettier/blob/main/scripts/tools/eslint-plugin-prettier-internal-rules/await-cli-tests.js",
},
messages: {
[MESSAGE_ID_CALL]:
"'runPrettier()' should be awaited or calling `.test()`.",
[MESSAGE_ID_GETTER]: "'runPrettier().{{property}}' should be awaited.",
[MESSAGE_ID_CALL]: "'runCli()' should be awaited or calling `.test()`.",
[MESSAGE_ID_GETTER]: "'runCli().{{property}}' should be awaited.",
},
},
create(context) {
@@ -16,26 +16,26 @@ const test = (ruleId, tests) => {
test("await-cli-tests", {
valid: [
"async () => await runPrettier()",
"runPrettier().test()",
"notRunPrettier()",
"async () => await runPrettier().stderr",
"async () => await runCli()",
"runCli().test()",
"notRunCli()",
"async () => await runCli().stderr",
outdent`
async () => {
const originalStdout = await runPrettier("plugins/options", ["--help"]).stdout;
const originalStdout = await runCli("plugins/options", ["--help"]).stdout;
}
`,
],
invalid: [
{
code: "runPrettier()",
code: "runCli()",
errors: [
{ message: "'runPrettier()' should be awaited or calling `.test()`." },
{ message: "'runCli()' should be awaited or calling `.test()`." },
],
},
{
code: "runPrettier().stderr",
errors: [{ message: "'runPrettier().stderr' should be awaited." }],
code: "runCli().stderr",
errors: [{ message: "'runCli().stderr' should be awaited." }],
},
],
});