@@ -6,12 +6,27 @@ const rimraf = require("rimraf");
66const os = require ( "os" ) ;
77const { resolve } = require ( "path" ) ;
88
9- const prettierTest = async ( ) => {
9+ const prettierTestWithoutForce = async ( ) => {
1010 const packageName = "prettier" ;
11- const rootPath = resolve ( os . tmpdir ( ) , "./test-assets" ) ;
12- const cliArgs = [ "init" , rootPath , "--force" ] ;
13- const logMessage = "Do you like to install prettier to format generated configuration?" ;
14- const status = await runTestStdout ( { packageName, cliArgs, logMessage } ) ;
11+ const rootPath = resolve ( os . tmpdir ( ) , "./test-assets-2" ) ;
12+ const cliArgs = [ "init" , rootPath ] ;
13+ const inputs = {
14+ "Which of the following JS solutions do you want to use?" : `\n` ,
15+ "Do you want to use webpack-dev-server?" : `n\n` ,
16+ "Do you want to simplify the creation of HTML files for your bundle?" : `n\n` ,
17+ "Do you want to add PWA support?" : `n\n` ,
18+ "Which of the following CSS solutions do you want to use?" : "\n" ,
19+ "Do you like to install prettier to format generated configuration?" : `n\n` ,
20+ "Pick a package manager" : "\n" ,
21+ } ;
22+ const logMessage =
23+ "Generated configuration may not be properly formatted as prettier is not installed" ;
24+ const status = await runTestStdoutWithInput ( {
25+ packageName,
26+ cliArgs,
27+ inputs,
28+ logMessage,
29+ } ) ;
1530 rimraf . sync ( rootPath ) ;
1631 return status ;
1732} ;
@@ -20,20 +35,16 @@ const prettierTestWithNoAnswer = async () => {
2035 const packageName = "prettier" ;
2136 const rootPath = resolve ( os . tmpdir ( ) , "./test-assets-2" ) ;
2237 const cliArgs = [ "init" , rootPath , "--force" ] ;
23- const inputs = {
24- "Do you like to install prettier to format generated configuration?" : "n\n" ,
25- } ;
2638 const logMessage =
2739 "Generated configuration may not be properly formatted as prettier is not installed" ;
28- const status = await runTestStdoutWithInput ( {
40+ const status = await runTestStdout ( {
2941 packageName,
3042 cliArgs,
31- inputs,
3243 logMessage,
3344 } ) ;
3445 rimraf . sync ( rootPath ) ;
3546 return status ;
3647} ;
3748
38- module . exports . run = [ prettierTest , prettierTestWithNoAnswer ] ;
49+ module . exports . run = [ prettierTestWithoutForce , prettierTestWithNoAnswer ] ;
3950module . exports . name = "Missing prettier" ;
0 commit comments