Skip to content

Commit 30037af

Browse files
committed
fix launch debugger tests
1 parent 1c20390 commit 30037af

File tree

2 files changed

+14
-26
lines changed

2 files changed

+14
-26
lines changed

src/test/testing/testController/pytest/pytestExecutionAdapter.unit.test.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,15 @@ suite('pytest test execution adapter', () => {
243243
});
244244
test('Debug launched correctly for pytest', async () => {
245245
const deferred3 = createDeferred();
246-
utilsWriteTestIdsFileStub.callsFake(() => {
247-
deferred3.resolve();
248-
return Promise.resolve('testIdPipe-mockName');
249-
});
246+
utilsWriteTestIdsFileStub.callsFake(() => Promise.resolve('testIdPipe-mockName'));
250247
debugLauncher
251248
.setup((dl) => dl.launchDebugger(typeMoq.It.isAny(), typeMoq.It.isAny()))
252-
.returns(async () => {
249+
.returns(async (_opts, callback) => {
253250
traceInfo('stubs launch debugger');
251+
if (typeof callback === 'function') {
252+
deferred3.resolve();
253+
callback();
254+
}
254255
});
255256
const testRun = typeMoq.Mock.ofType<TestRun>();
256257
testRun
@@ -264,14 +265,7 @@ suite('pytest test execution adapter', () => {
264265
const uri = Uri.file(myTestPath);
265266
const outputChannel = typeMoq.Mock.ofType<ITestOutputChannel>();
266267
adapter = new PytestTestExecutionAdapter(configService, outputChannel.object);
267-
await adapter.runTests(
268-
uri,
269-
[],
270-
TestRunProfileKind.Debug,
271-
testRun.object,
272-
execFactory.object,
273-
debugLauncher.object,
274-
);
268+
adapter.runTests(uri, [], TestRunProfileKind.Debug, testRun.object, execFactory.object, debugLauncher.object);
275269
await deferred3.promise;
276270
debugLauncher.verify(
277271
(x) =>

src/test/testing/testController/unittest/testExecutionAdapter.unit.test.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,15 @@ suite('Unittest test execution adapter', () => {
242242
});
243243
test('Debug launched correctly for unittest', async () => {
244244
const deferred3 = createDeferred();
245-
utilsWriteTestIdsFileStub.callsFake(() => {
246-
deferred3.resolve();
247-
return Promise.resolve('testIdPipe-mockName');
248-
});
245+
utilsWriteTestIdsFileStub.callsFake(() => Promise.resolve('testIdPipe-mockName'));
249246
debugLauncher
250247
.setup((dl) => dl.launchDebugger(typeMoq.It.isAny(), typeMoq.It.isAny()))
251-
.returns(async () => {
248+
.returns(async (_opts, callback) => {
252249
traceInfo('stubs launch debugger');
250+
if (typeof callback === 'function') {
251+
deferred3.resolve();
252+
callback();
253+
}
253254
});
254255
const testRun = typeMoq.Mock.ofType<TestRun>();
255256
testRun
@@ -263,14 +264,7 @@ suite('Unittest test execution adapter', () => {
263264
const uri = Uri.file(myTestPath);
264265
const outputChannel = typeMoq.Mock.ofType<ITestOutputChannel>();
265266
adapter = new UnittestTestExecutionAdapter(configService, outputChannel.object);
266-
await adapter.runTests(
267-
uri,
268-
[],
269-
TestRunProfileKind.Debug,
270-
testRun.object,
271-
execFactory.object,
272-
debugLauncher.object,
273-
);
267+
adapter.runTests(uri, [], TestRunProfileKind.Debug, testRun.object, execFactory.object, debugLauncher.object);
274268
await deferred3.promise;
275269
debugLauncher.verify(
276270
(x) =>

0 commit comments

Comments
 (0)