Skip to content

Commit f596c91

Browse files
committed
🔨 use utils
1 parent 91a7089 commit f596c91

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

src/test/debugger/module.test.ts

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,21 @@ import * as path from 'path';
99
import { DebugClient } from 'vscode-debugadapter-testsupport';
1010
import { EXTENSION_ROOT_DIR } from '../../client/common/constants';
1111
import { noop } from '../../client/common/core.utils';
12-
import { IS_WINDOWS } from '../../client/common/platform/constants';
1312
import { DebugOptions, LaunchRequestArguments } from '../../client/debugger/Common/Contracts';
1413
import { sleep } from '../common';
1514
import { IS_MULTI_ROOT_TEST, TEST_DEBUGGER } from '../initialize';
16-
import { DEBUGGER_TIMEOUT } from './common/constants';
17-
import { DebugClientEx } from './debugClient';
15+
import { createDebugAdapter } from './utils';
1816

19-
const testAdapterFilePath = path.join(EXTENSION_ROOT_DIR, 'out', 'client', 'debugger', 'mainV2.js');
2017
const workspaceDirectory = path.join(EXTENSION_ROOT_DIR, 'src', 'testMultiRootWkspc', 'workspace5');
21-
let testCounter = 0;
2218
const debuggerType = 'pythonExperimental';
2319
suite(`Module Debugging - Misc tests: ${debuggerType}`, () => {
2420
let debugClient: DebugClient;
2521
setup(async function () {
2622
if (!IS_MULTI_ROOT_TEST || !TEST_DEBUGGER) {
2723
this.skip();
2824
}
29-
await new Promise(resolve => setTimeout(resolve, 1000));
30-
debugClient = createDebugAdapter();
31-
debugClient.defaultTimeout = DEBUGGER_TIMEOUT;
32-
await debugClient.start();
25+
const coverageDirectory = path.join(EXTENSION_ROOT_DIR, 'debug_coverage_module');
26+
debugClient = await createDebugAdapter(coverageDirectory);
3327
});
3428
teardown(async () => {
3529
// Wait for a second before starting another test (sometimes, sockets take a while to get closed).
@@ -40,19 +34,6 @@ suite(`Module Debugging - Misc tests: ${debuggerType}`, () => {
4034
} catch (ex) { }
4135
await sleep(1000);
4236
});
43-
/**
44-
* Creates the debug adapter.
45-
* We do not need to support code coverage on AppVeyor, lets use the standard test adapter.
46-
* @returns {DebugClient}
47-
*/
48-
function createDebugAdapter(): DebugClient {
49-
if (IS_WINDOWS) {
50-
return new DebugClient('node', testAdapterFilePath, debuggerType);
51-
} else {
52-
const coverageDirectory = path.join(EXTENSION_ROOT_DIR, `debug_coverage${testCounter += 1}`);
53-
return new DebugClientEx(testAdapterFilePath, debuggerType, coverageDirectory, { cwd: EXTENSION_ROOT_DIR });
54-
}
55-
}
5637
function buildLauncArgs(): LaunchRequestArguments {
5738
const env = {};
5839
// tslint:disable-next-line:no-string-literal

0 commit comments

Comments
 (0)