Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/client/common/application/commands/reportIssueCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ export class ReportIssueCommandHandler implements IExtensionSingleActivationServ

private argSettingsPath = path.join(EXTENSION_ROOT_DIR, 'resources', 'report_issue_user_settings.json');

private templatePath = path.join(EXTENSION_ROOT_DIR, 'resources', 'report_issue_template.md');

private userDataTemplatePath = path.join(EXTENSION_ROOT_DIR, 'resources', 'report_issue_user_data_template.md');

public async openReportIssue(): Promise<void> {
Expand Down Expand Up @@ -88,7 +86,6 @@ export class ReportIssueCommandHandler implements IExtensionSingleActivationServ
}
}
});
const template = await fs.readFile(this.templatePath, 'utf8');
const userTemplate = await fs.readFile(this.userDataTemplatePath, 'utf8');
const interpreter = await this.interpreterService.getActiveInterpreter();
const pythonVersion = interpreter?.version?.raw ?? '';
Expand Down Expand Up @@ -120,8 +117,7 @@ export class ReportIssueCommandHandler implements IExtensionSingleActivationServ

await this.commandManager.executeCommand('workbench.action.openIssueReporter', {
extensionId: 'ms-python.python',
issueBody: template,
data: userTemplate.format(
issueBody: userTemplate.format(
pythonVersion,
virtualEnvKind,
languageServer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ suite('Report Issue Command', () => {
let interpreterService: IInterpreterService;
let configurationService: IConfigurationService;
let appEnvironment: IApplicationEnvironment;
let expectedIssueBody: string;
let getExtensionsStub: sinon.SinonStub;

setup(async () => {
Expand Down Expand Up @@ -84,17 +83,6 @@ suite('Report Issue Command', () => {
);
await reportIssueCommandHandler.activate();

const issueTemplatePath = path.join(
EXTENSION_ROOT_DIR_FOR_TESTS,
'src',
'test',
'common',
'application',
'commands',
'issueTemplate.md',
);
expectedIssueBody = fs.readFileSync(issueTemplatePath, 'utf8');

getExtensionsStub.returns([
{
id: 'ms-python.python',
Expand Down Expand Up @@ -126,17 +114,16 @@ suite('Report Issue Command', () => {
);
const expectedData = fs.readFileSync(userDataTemplatePath, 'utf8');

const args: [string, { extensionId: string; issueBody: string; data: string }] = capture<
const args: [string, { extensionId: string; issueBody: string }] = capture<
AllCommands,
{ extensionId: string; issueBody: string; data: string }
{ extensionId: string; issueBody: string }
>(cmdManager.executeCommand).last();

verify(cmdManager.registerCommand(Commands.ReportIssue, anything(), anything())).once();
verify(cmdManager.executeCommand('workbench.action.openIssueReporter', anything())).once();
expect(args[0]).to.be.equal('workbench.action.openIssueReporter');
const { issueBody, data } = args[1];
expect(issueBody).to.be.equal(expectedIssueBody);
expect(data).to.be.equal(expectedData);
const { issueBody } = args[1];
expect(issueBody).to.be.equal(expectedData);
});

test('Test if issue body is filled when only including settings which are explicitly set', async () => {
Expand Down Expand Up @@ -167,16 +154,15 @@ suite('Report Issue Command', () => {
);
const expectedData = fs.readFileSync(userDataTemplatePath, 'utf8');

const args: [string, { extensionId: string; issueBody: string; data: string }] = capture<
const args: [string, { extensionId: string; issueBody: string }] = capture<
AllCommands,
{ extensionId: string; issueBody: string; data: string }
{ extensionId: string; issueBody: string }
>(cmdManager.executeCommand).last();

verify(cmdManager.executeCommand('workbench.action.openIssueReporter', anything())).once();
expect(args[0]).to.be.equal('workbench.action.openIssueReporter');
const { issueBody, data } = args[1];
expect(issueBody).to.be.equal(expectedIssueBody);
expect(data).to.be.equal(expectedData);
const { issueBody } = args[1];
expect(issueBody).to.be.equal(expectedData);
});
test('Should send telemetry event when run Report Issue Command', async () => {
const sendTelemetryStub = sinon.stub(Telemetry, 'sendTelemetryEvent');
Expand Down
Loading