Skip to content

Commit 044323f

Browse files
committed
v2.3
1 parent 8492542 commit 044323f

File tree

6 files changed

+202
-429
lines changed

6 files changed

+202
-429
lines changed

src/client/testing/common/runner.ts

Lines changed: 0 additions & 129 deletions
This file was deleted.

src/client/testing/common/types.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,3 @@ export interface IUnitTestSocketServer extends Disposable {
100100
start(options?: { port?: number; host?: string }): Promise<number>;
101101
stop(): void;
102102
}
103-
104-
export const ITestRunner = Symbol('ITestRunner');
105-
export interface ITestRunner {
106-
run(testProvider: TestProvider, options: Options): Promise<string>;
107-
}

src/client/testing/serviceRegistry.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
import { IExtensionActivationService } from '../activation/types';
55
import { IServiceManager } from '../ioc/types';
66
import { DebugLauncher } from './common/debugLauncher';
7-
import { TestRunner } from './common/runner';
87
import { TestConfigSettingsService } from './common/configSettingService';
98
import { TestsHelper } from './common/testUtils';
109
import {
1110
ITestConfigSettingsService,
1211
ITestConfigurationManagerFactory,
1312
ITestConfigurationService,
1413
ITestDebugLauncher,
15-
ITestRunner,
1614
ITestsHelper,
1715
IUnitTestSocketServer,
1816
} from './common/types';
@@ -29,8 +27,6 @@ export function registerTypes(serviceManager: IServiceManager) {
2927
serviceManager.add<ITestsHelper>(ITestsHelper, TestsHelper);
3028
serviceManager.add<IUnitTestSocketServer>(IUnitTestSocketServer, UnitTestSocketServer);
3129

32-
serviceManager.add<ITestRunner>(ITestRunner, TestRunner);
33-
3430
serviceManager.addSingleton<ITestConfigurationService>(ITestConfigurationService, UnitTestConfigurationService);
3531
serviceManager.addSingleton<ITestingService>(ITestingService, TestingService);
3632

src/client/testing/testController/common/testItemUtilities.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -498,13 +498,6 @@ export async function updateTestItemFromRawData(
498498
item.busy = false;
499499
}
500500

501-
export function getUri(node: TestItem): Uri | undefined {
502-
if (!node.uri && node.parent) {
503-
return getUri(node.parent);
504-
}
505-
return node.uri;
506-
}
507-
508501
export function getTestCaseNodes(testNode: TestItem, collection: TestItem[] = []): TestItem[] {
509502
if (!testNode.canResolveChildren && testNode.tags.length > 0) {
510503
collection.push(testNode);

src/client/testing/testController/common/utils.ts

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,12 @@ import { Deferred, createDeferred } from '../../../common/utils/async';
1919
import { createReaderPipe, generateRandomPipeName } from '../../../common/pipes/namedPipes';
2020
import { EXTENSION_ROOT_DIR } from '../../../constants';
2121

22-
export function fixLogLines(content: string): string {
23-
const lines = content.split(/\r?\n/g);
24-
return `${lines.join('\r\n')}\r\n`;
25-
}
2622

2723
export function fixLogLinesNoTrailing(content: string): string {
2824
const lines = content.split(/\r?\n/g);
2925
return `${lines.join('\r\n')}`;
3026
}
31-
export interface IJSONRPCData {
32-
extractedJSON: string;
33-
remainingRawData: string;
34-
}
35-
36-
export interface ParsedRPCHeadersAndData {
37-
headers: Map<string, string>;
38-
remainingRawData: string;
39-
}
4027

41-
export interface ExtractOutput {
42-
uuid: string | undefined;
43-
cleanedJsonData: string | undefined;
44-
remainingRawData: string;
45-
}
46-
47-
export const JSONRPC_UUID_HEADER = 'Request-uuid';
48-
export const JSONRPC_CONTENT_LENGTH_HEADER = 'Content-Length';
49-
export const JSONRPC_CONTENT_TYPE_HEADER = 'Content-Type';
5028
export const MESSAGE_ON_TESTING_OUTPUT_MOVE =
5129
'Starting now, all test run output will be sent to the Test Result panel,' +
5230
' while test discovery output will be sent to the "Python" output channel instead of the "Python Test Log" channel.' +
@@ -58,66 +36,6 @@ export function createTestingDeferred(): Deferred<void> {
5836
}
5937

6038

61-
export function parseJsonRPCHeadersAndData(rawData: string): ParsedRPCHeadersAndData {
62-
/**
63-
* Parses the provided raw data to extract JSON-RPC specific headers and remaining data.
64-
*
65-
* This function aims to extract specific JSON-RPC headers (like UUID, content length,
66-
* and content type) from the provided raw string data. Headers are expected to be
67-
* delimited by newlines and the format should be "key:value". The function stops parsing
68-
* once it encounters an empty line, and the rest of the data after this line is treated
69-
* as the remaining raw data.
70-
*
71-
* @param {string} rawData - The raw string containing headers and possibly other data.
72-
* @returns {ParsedRPCHeadersAndData} An object containing the parsed headers as a map and the
73-
* remaining raw data after the headers.
74-
*/
75-
const lines = rawData.split('\n');
76-
let remainingRawData = '';
77-
const headerMap = new Map<string, string>();
78-
for (let i = 0; i < lines.length; i += 1) {
79-
const line = lines[i];
80-
if (line === '') {
81-
remainingRawData = lines.slice(i + 1).join('\n');
82-
break;
83-
}
84-
const [key, value] = line.split(':');
85-
if (value && value.trim()) {
86-
if ([JSONRPC_UUID_HEADER, JSONRPC_CONTENT_LENGTH_HEADER, JSONRPC_CONTENT_TYPE_HEADER].includes(key)) {
87-
headerMap.set(key.trim(), value.trim());
88-
}
89-
}
90-
}
91-
92-
return {
93-
headers: headerMap,
94-
remainingRawData,
95-
};
96-
}
97-
98-
export function ExtractJsonRPCData(payloadLength: string | undefined, rawData: string): IJSONRPCData {
99-
/**
100-
* Extracts JSON-RPC content based on provided headers and raw data.
101-
*
102-
* This function uses the `Content-Length` header from the provided headers map
103-
* to determine how much of the rawData string represents the actual JSON content.
104-
* After extracting the expected content, it also returns any remaining data
105-
* that comes after the extracted content as remaining raw data.
106-
*
107-
* @param {string | undefined} payloadLength - The value of the `Content-Length` header.
108-
* @param {string} rawData - The raw string data from which the JSON content will be extracted.
109-
*
110-
* @returns {IJSONRPCContent} An object containing the extracted JSON content and any remaining raw data.
111-
*/
112-
const length = parseInt(payloadLength ?? '0', 10);
113-
const data = rawData.slice(0, length);
114-
const remainingRawData = rawData.slice(length);
115-
return {
116-
extractedJSON: data,
117-
remainingRawData,
118-
};
119-
}
120-
12139
interface ExecutionResultMessage extends Message {
12240
params: ExecutionTestPayload;
12341
}

0 commit comments

Comments
 (0)