@@ -31,8 +31,7 @@ describe("parser", () => {
31
31
}
32
32
33
33
it ( "should parse nothing" , ( ) => {
34
- expect ( parse ( [ ] ) ) . toBe ( { _ : [ ] } )
35
- } )
34
+ expect ( parse ( [ ] ) ) . toStrictEqual ( { _ : [ ] } ) } )
36
35
37
36
it ( "should parse all available options" , ( ) => {
38
37
expect (
@@ -114,7 +113,7 @@ describe("parser", () => {
114
113
115
114
process . env . LOG_LEVEL = "debug"
116
115
const defaults = await setDefaults ( args )
117
- expect ( defaults ) . toEqual ( {
116
+ expect ( defaults ) . toStrictEqual ( {
118
117
...defaults ,
119
118
_ : [ ] ,
120
119
log : "debug" ,
@@ -125,7 +124,7 @@ describe("parser", () => {
125
124
126
125
process . env . LOG_LEVEL = "trace"
127
126
const updated = await setDefaults ( args )
128
- expect ( updated ) . toBe ( {
127
+ expect ( updated ) . toStrictEqual ( {
129
128
...updated ,
130
129
_ : [ ] ,
131
130
log : "trace" ,
@@ -353,53 +352,47 @@ describe("cli", () => {
353
352
} )
354
353
355
354
it ( "should use existing if inside code-server" , async ( ) => {
356
- process . env . VSCODE_IPC_HOOK_CLI = "test"
357
- const shouldOpen = await shouldOpenInExistingInstance ( args )
358
- expect ( shouldOpen ) . toStrictEqual ( "test" )
355
+ process . env . VSCODE_IPC_HOOK_CLI = "test"
356
+ expect ( await shouldOpenInExistingInstance ( args ) ) . toStrictEqual ( "test" )
359
357
360
358
args . port = 8081
361
- args . _ . push ( "./file" )
362
- const _shouldOpen = await shouldOpenInExistingInstance ( args )
363
- expect ( _shouldOpen ) . toStrictEqual ( "test" )
359
+ args . _ . push ( "./file" )
360
+ expect ( await shouldOpenInExistingInstance ( args ) ) . toStrictEqual ( "test" )
364
361
} )
365
362
366
363
it ( "should use existing if --reuse-window is set" , async ( ) => {
367
364
args [ "reuse-window" ] = true
368
- const shouldOpen = await shouldOpenInExistingInstance ( args )
369
- await expect ( shouldOpen ) . toStrictEqual ( undefined )
365
+ await expect ( await shouldOpenInExistingInstance ( args ) ) . toStrictEqual ( undefined )
370
366
371
367
await fs . writeFile ( vscodeIpcPath , "test" )
372
368
await expect ( shouldOpenInExistingInstance ( args ) ) . resolves . toStrictEqual ( "test" )
373
369
374
370
args . port = 8081
375
371
await expect ( shouldOpenInExistingInstance ( args ) ) . resolves . toStrictEqual ( "test" )
376
372
} )
377
-
378
- // TODO
379
- // fix red squiggles
380
- // and don't use should Open on all these
373
+
381
374
it ( "should use existing if --new-window is set" , async ( ) => {
382
375
args [ "new-window" ] = true
383
- expect ( await shouldOpenInExistingInstance ( args ) . toStrictEqual ( undefined )
376
+ expect ( await shouldOpenInExistingInstance ( args ) ) . toStrictEqual ( undefined )
384
377
385
378
await fs . writeFile ( vscodeIpcPath , "test" )
386
- expect ( await shouldOpenInExistingInstance ( args ) . toStrictEqual ( "test" )
379
+ expect ( await shouldOpenInExistingInstance ( args ) ) . toStrictEqual ( "test" )
387
380
388
381
args . port = 8081
389
- expect ( await shouldOpenInExistingInstance ( args ) . toStrictEqual ( "test" )
382
+ expect ( await shouldOpenInExistingInstance ( args ) ) . toStrictEqual ( "test" )
390
383
} )
391
384
392
385
it (
393
386
"should use existing if no unrelated flags are set, has positional, and socket is active" ,
394
387
async ( ) => {
395
- expect ( await shouldOpenInExistingInstance ( args ) . toStrictEqual ( undefined )
388
+ expect ( await shouldOpenInExistingInstance ( args ) ) . toStrictEqual ( undefined )
396
389
397
390
args . _ . push ( "./file" )
398
- expect ( await shouldOpenInExistingInstance ( args ) . toStrictEqual ( undefined )
391
+ expect ( await shouldOpenInExistingInstance ( args ) ) . toStrictEqual ( undefined )
399
392
400
393
const socketPath = path . join ( testDir , "socket" )
401
394
await fs . writeFile ( vscodeIpcPath , socketPath )
402
- expect ( await shouldOpenInExistingInstance ( args ) . toStrictEqual ( undefined )
395
+ expect ( await shouldOpenInExistingInstance ( args ) ) . toStrictEqual ( undefined )
403
396
404
397
await new Promise ( ( resolve ) => {
405
398
const server = net . createServer ( ( ) => {
@@ -410,10 +403,10 @@ describe("cli", () => {
410
403
server . listen ( socketPath )
411
404
} )
412
405
413
- expect ( await shouldOpenInExistingInstance ( args ) . toStrictEqual ( socketPath )
406
+ expect ( await shouldOpenInExistingInstance ( args ) ) . toStrictEqual ( socketPath )
414
407
415
408
args . port = 8081
416
- expect ( await shouldOpenInExistingInstance ( args ) . toStrictEqual ( undefined )
409
+ expect ( await shouldOpenInExistingInstance ( args ) ) . toStrictEqual ( undefined )
417
410
}
418
411
)
419
412
} )
0 commit comments