22 * Copyright (C) Microsoft Corporation. All rights reserved.
33 *--------------------------------------------------------*/
44
5- import { DebugProtocol } from 'vscode-debugprotocol' ;
6- import { chromeConnection , ISourceMapPathOverrides , telemetry , utils as coreUtils , ChromeDebugSession } from 'vscode-chrome-debug-core' ;
7-
8- import * as mockery from 'mockery' ;
9- import { EventEmitter } from 'events' ;
105import * as assert from 'assert' ;
11- import { Mock , MockBehavior , It , IMock , Times } from 'typemoq' ;
12-
6+ import { EventEmitter } from 'events' ;
7+ import * as mockery from 'mockery' ;
8+ import { IMock , It , Mock , MockBehavior , Times } from 'typemoq' ;
9+ import { chromeConnection , ISourceMapPathOverrides , telemetry } from 'vscode-chrome-debug-core' ;
10+ import { DebugProtocol } from 'vscode-debugprotocol' ;
11+ import { ChromeDebugAdapter as _ChromeDebugAdapter } from '../src/chromeDebugAdapter' ;
1312import { getMockChromeConnectionApi , IMockChromeConnectionAPI } from './debugProtocolMocks' ;
1413import * as testUtils from './testUtils' ;
1514
16- /** Not mocked - use for type only */
17- import { ChromeDebugAdapter as _ChromeDebugAdapter } from '../src/chromeDebugAdapter' ;
18-
1915class MockChromeDebugSession {
2016 public sendEvent ( event : DebugProtocol . Event ) : void {
2117 }
@@ -160,26 +156,26 @@ suite('ChromeDebugAdapter', () => {
160156 let collectedLaunchParams : any ;
161157 mockChromeDebugSession
162158 . setup ( x => x . sendRequest ( 'launchUnelevated' ,
163- It . is ( ( x : any ) => {
164- collectedLaunchParams = x ;
165- return true ;
166- } ) ,
167- 10000 ,
168- It . is (
169- ( callback : ( response : DebugProtocol . Response ) => void ) => {
170- callback ( {
171- seq : null ,
172- type : 'command' ,
173- request_seq : 100 ,
174- command : 'launchUnelevated' ,
175- success : true ,
176- body : {
177- processId : expectedProcessId
178- }
179- } ) ;
159+ It . is ( ( param : any ) => {
160+ collectedLaunchParams = param ;
180161 return true ;
181- } ) ) )
182- . verifiable ( Times . atLeast ( 1 ) ) ;
162+ } ) ,
163+ 10000 ,
164+ It . is (
165+ ( callback : ( response : DebugProtocol . Response ) => void ) => {
166+ callback ( {
167+ seq : null ,
168+ type : 'command' ,
169+ request_seq : 100 ,
170+ command : 'launchUnelevated' ,
171+ success : true ,
172+ body : {
173+ processId : expectedProcessId
174+ }
175+ } ) ;
176+ return true ;
177+ } ) ) )
178+ . verifiable ( Times . atLeast ( 1 ) ) ;
183179
184180 await chromeDebugAdapter . launch ( {
185181 file : 'c:\\path with space\\index.html' ,
@@ -192,19 +188,19 @@ suite('ChromeDebugAdapter', () => {
192188 assert ( collectedLaunchParams . process . match ( / c h r o m e / i) ) ;
193189 assert ( collectedLaunchParams . args != null ) ;
194190
195- assert ( collectedLaunchParams . args . filter ( ( x ) => x == '--no-default-browser-check' ) . length != 0 ,
191+ assert ( collectedLaunchParams . args . filter ( arg => arg === '--no-default-browser-check' ) . length != = 0 ,
196192 'Should have seen the --no-default-browser-check parameter' ) ;
197- assert ( collectedLaunchParams . args . filter ( ( x ) => x == '--no-first-run' ) . length != 0 ,
193+ assert ( collectedLaunchParams . args . filter ( arg => arg === '--no-first-run' ) . length != = 0 ,
198194 'Should have seen the --no-first-run parameter' ) ;
199- assert ( collectedLaunchParams . args . filter ( ( x ) => x == 'abc' ) . length != 0 ,
195+ assert ( collectedLaunchParams . args . filter ( arg => arg === 'abc' ) . length != = 0 ,
200196 'Should have seen the abc parameter' ) ;
201- assert ( collectedLaunchParams . args . filter ( ( x ) => x == 'def' ) . length != 0 ,
197+ assert ( collectedLaunchParams . args . filter ( arg => arg === 'def' ) . length != = 0 ,
202198 'Should have seen the def parameter' ) ;
203- assert ( collectedLaunchParams . args . filter ( ( x ) => x == 'about:blank' ) . length != 0 ,
199+ assert ( collectedLaunchParams . args . filter ( arg => arg === 'about:blank' ) . length != = 0 ,
204200 'Should have seen the about:blank parameter' ) ;
205- assert ( collectedLaunchParams . args . filter ( ( x ) => x . match ( / r e m o t e - d e b u g g i n g - p o r t / ) ) . length != 0 ,
201+ assert ( collectedLaunchParams . args . filter ( arg => arg . match ( / r e m o t e - d e b u g g i n g - p o r t / ) ) . length != = 0 ,
206202 'Should have seen a parameter like remote-debugging-port' ) ;
207- assert ( collectedLaunchParams . args . filter ( ( x ) => x . match ( / u s e r - d a t a - d i r / ) ) . length != 0 ,
203+ assert ( collectedLaunchParams . args . filter ( arg => arg . match ( / u s e r - d a t a - d i r / ) ) . length != = 0 ,
208204 'Should have seen a parameter like user-data-dir' ) ;
209205
210206 const telemetryProperties = telemetryPropertyCollector . getProperties ( ) ;
@@ -213,8 +209,6 @@ suite('ChromeDebugAdapter', () => {
213209
214210 require ( 'os' ) . platform = originalGetPlatform ;
215211 require ( '../src/utils' ) . getBrowserPath = originalGetBrowser ;
216-
217- return Promise . resolve ( ) ;
218212 } ) ;
219213 } ) ;
220214
0 commit comments