Skip to content

Commit e14e1d4

Browse files
committed
tests: ignore prompts
1 parent d52bdd1 commit e14e1d4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/cli.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,15 @@ const onLoad = async (targetDir, version, argv) => {
7979
name: "langChoice",
8080
message: "Select language",
8181
choices: langListOut,
82-
suggest: async (input, choices) => {
82+
suggest: /* istanbul ignore next */ async (input, choices) => {
8383
return fuzzy
8484
.filter(input, choices, { extract: (el) => el.title })
8585
.map((v) => v.original);
8686
},
8787
},
8888
];
89-
let lang = argv.lang || null;
89+
let lang = argv.lang;
90+
/* istanbul ignore if */
9091
if (!lang) {
9192
let { langChoice } = await prompts(questions);
9293
if (langChoice === "custom") {
@@ -97,17 +98,18 @@ const onLoad = async (targetDir, version, argv) => {
9798
});
9899
langChoice = customLang;
99100
}
100-
lang = langChoice;
101+
lang = langChoice || "";
101102
}
102103
try {
103104
const indexFile = targetDir + "/index.html";
104105
const sourceHTML = await fs.readFile(indexFile, "utf-8");
105106
const resultHTML = sourceHTML.replace(
106107
/(<html.*lang=)\"([^"]*)\"/gi,
107-
`$1"${lang || ""}"`
108+
`$1"${lang}"`
108109
);
109110
await fs.writeFile(indexFile, resultHTML);
110111
} catch (err) {
112+
/* istanbul ignore next */
111113
throw new Error(err);
112114
}
113115
};

0 commit comments

Comments
 (0)