Skip to content
This repository was archived by the owner on Dec 6, 2022. It is now read-only.

Commit c54e7fa

Browse files
committed
Fix test linting
1 parent 0bf1e63 commit c54e7fa

2 files changed

Lines changed: 34 additions & 39 deletions

File tree

gulpfile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ const scripts = [
5050
];
5151

5252
const lintSources = [
53-
'src'
53+
'src',
54+
'test'
5455
].map(function (tsFolder) { return tsFolder + '/**/*.ts'; });
5556

5657
const tsProject = ts.createProject('tsconfig.json', { typescript });

test/chromeDebugAdapter.test.ts

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,16 @@
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';
105
import * 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';
1312
import { getMockChromeConnectionApi, IMockChromeConnectionAPI } from './debugProtocolMocks';
1413
import * as testUtils from './testUtils';
1514

16-
/** Not mocked - use for type only */
17-
import {ChromeDebugAdapter as _ChromeDebugAdapter } from '../src/chromeDebugAdapter';
18-
1915
class 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(/chrome/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(/remote-debugging-port/)).length != 0,
201+
assert(collectedLaunchParams.args.filter(arg => arg.match(/remote-debugging-port/)).length !== 0,
206202
'Should have seen a parameter like remote-debugging-port');
207-
assert(collectedLaunchParams.args.filter((x) => x.match(/user-data-dir/)).length != 0,
203+
assert(collectedLaunchParams.args.filter(arg => arg.match(/user-data-dir/)).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

Comments
 (0)