File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ describe("getUserConfigStr", () => {
264264config:
265265 name: 配置名称
266266 value: 123
267- ==UserConfig== */
267+ ==/ UserConfig== */
268268
269269console.log('Hello World');
270270` ;
@@ -274,7 +274,7 @@ console.log('Hello World');
274274config:
275275 name: 配置名称
276276 value: 123
277- ==UserConfig== */` ) ;
277+ ==/ UserConfig== */` ) ;
278278 } ) ;
279279
280280 test ( "没有UserConfig标签应返回null" , ( ) => {
@@ -302,7 +302,7 @@ describe("parseUserConfig", () => {
302302name: 测试配置
303303value: 123
304304enabled: true
305- ==UserConfig== */
305+ ==/ UserConfig== */
306306
307307console.log('Hello World');
308308` ;
@@ -324,7 +324,7 @@ value: 123
324324name: 配置2
325325value: 456
326326enabled: true
327- ==UserConfig== */
327+ ==/ UserConfig== */
328328
329329console.log('Hello World');
330330` ;
@@ -346,7 +346,7 @@ console.log('Hello World');
346346 test ( "解析空的UserConfig" , ( ) => {
347347 const code = `
348348/* ==UserConfig==
349- ==UserConfig== */
349+ ==/ UserConfig== */
350350
351351console.log('Hello World');
352352` ;
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ export function parseUserConfig(code: string): UserConfig | undefined {
8787 const ret : UserConfig = { } ;
8888 configs . forEach ( ( val ) => {
8989 const obj : UserConfig = YAML . parse ( val ) ;
90- Object . keys ( obj ) . forEach ( ( key ) => {
90+ Object . keys ( obj || { } ) . forEach ( ( key ) => {
9191 ret [ key ] = obj [ key ] ;
9292 } ) ;
9393 } ) ;
You can’t perform that action at this time.
0 commit comments