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) {
34
34
}
35
35
36
36
describe ( '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
+
37
53
const answers = {
38
54
name : 'vue-cli-test' ,
39
55
author : 'John Doe <john@doe.com>' ,
@@ -106,6 +122,22 @@ describe('vue-cli', () => {
106
122
} )
107
123
} )
108
124
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
+
109
141
it ( 'avoid rendering files that do not have mustaches' , done => {
110
142
monkeyPatchInquirer ( answers )
111
143
const binFilePath = `${ MOCK_TEMPLATE_REPO_PATH } /template/bin.file`
You can’t perform that action at this time.
0 commit comments