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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"onDebugInitialConfigurations",
"onLanguage:python",
"onDebugResolve:python",
"onCommand:python.configureTests",
"onCommand:python.copilotSetupTests",
"workspaceContains:mspythonconfig.json",
"workspaceContains:pyproject.toml",
Expand Down
43 changes: 43 additions & 0 deletions src/test/testing/configureTestsActivation.unit.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

'use strict';

import { expect } from 'chai';
import * as path from 'path';
import * as fs from 'fs';

suite('Configure Tests Command Activation', () => {
test('onCommand:python.configureTests should be included in activation events', () => {
// Read package.json from the project root
const packageJsonPath = path.join(__dirname, '..', '..', '..', 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));

// Verify that the activation events include the command
const activationEvents = packageJson.activationEvents;
expect(activationEvents).to.include('onCommand:python.configureTests');
});

test('python.configureTests command should be declared in contributes.commands', () => {
// Read package.json from the project root
const packageJsonPath = path.join(__dirname, '..', '..', '..', 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));

// Verify that the command is declared in contributes.commands
const commands = packageJson.contributes.commands;
const configureTestsCommand = commands.find((cmd: any) => cmd.command === 'python.configureTests');
expect(configureTestsCommand).to.not.be.undefined;
expect(configureTestsCommand.category).to.equal('Python');
});

test('Both configureTests and copilotSetupTests commands should have activation events', () => {
// Read package.json from the project root
const packageJsonPath = path.join(__dirname, '..', '..', '..', 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));

// Verify both test-related commands have activation events
const activationEvents = packageJson.activationEvents;
expect(activationEvents).to.include('onCommand:python.configureTests');
expect(activationEvents).to.include('onCommand:python.copilotSetupTests');
});
});
Loading