File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,22 @@ function monkeyPatchInquirer (answers) {
3434}
3535
3636describe ( 'vue-cli' , ( ) => {
37+ /* eslint-disable quotes */
38+ const escapedAuthor = "John \"The Tester\" Doe <john@doe.com>"
39+
40+ const escapedAnswers = {
41+ name : 'vue-cli-test' ,
42+ author : 'John "The Tester" Doe <john@doe.com>' ,
43+ description : 'vue-cli e2e test' ,
44+ preprocessor : {
45+ less : true ,
46+ sass : true
47+ } ,
48+ pick : 'no' ,
49+ noEscape : true
50+
51+ }
52+
3753 const answers = {
3854 name : 'vue-cli-test' ,
3955 author : 'John Doe <john@doe.com>' ,
@@ -106,6 +122,22 @@ describe('vue-cli', () => {
106122 } )
107123 } )
108124
125+ it ( 'generate a vaild package.json with escaped author' , done => {
126+ monkeyPatchInquirer ( escapedAnswers )
127+ generate ( 'test' , MOCK_TEMPLATE_REPO_PATH , MOCK_TEMPLATE_BUILD_PATH , err => {
128+ if ( err ) done ( err )
129+
130+ const pkg = fs . readFileSync ( `${ MOCK_TEMPLATE_BUILD_PATH } /package.json` , 'utf8' )
131+ try {
132+ var validData = JSON . parse ( pkg )
133+ expect ( validData . author ) . to . equal ( escapedAuthor )
134+ done ( )
135+ } catch ( err ) {
136+ done ( err )
137+ }
138+ } )
139+ } )
140+
109141 it ( 'avoid rendering files that do not have mustaches' , done => {
110142 monkeyPatchInquirer ( answers )
111143 const binFilePath = `${ MOCK_TEMPLATE_REPO_PATH } /template/bin.file`
You can’t perform that action at this time.
0 commit comments