diff --git a/package.json b/package.json index a8a94ada4027..bc9e519e998f 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "onDebugInitialConfigurations", "onLanguage:python", "onDebugResolve:python", + "onCommand:python.configureTests", "onCommand:python.copilotSetupTests", "workspaceContains:mspythonconfig.json", "workspaceContains:pyproject.toml", diff --git a/src/test/testing/configureTestsActivation.unit.test.ts b/src/test/testing/configureTestsActivation.unit.test.ts new file mode 100644 index 000000000000..f52a88943d70 --- /dev/null +++ b/src/test/testing/configureTestsActivation.unit.test.ts @@ -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'); + }); +}); \ No newline at end of file