1+ // Copyright (c) Microsoft Corporation. All rights reserved.
2+ // Licensed under the MIT License.
3+
4+ 'use strict' ;
5+
6+ import { expect } from 'chai' ;
7+ import * as path from 'path' ;
8+ import * as fs from 'fs' ;
9+
10+ suite ( 'Configure Tests Command Activation' , ( ) => {
11+ test ( 'onCommand:python.configureTests should be included in activation events' , ( ) => {
12+ // Read package.json from the project root
13+ const packageJsonPath = path . join ( __dirname , '..' , '..' , '..' , 'package.json' ) ;
14+ const packageJson = JSON . parse ( fs . readFileSync ( packageJsonPath , 'utf8' ) ) ;
15+
16+ // Verify that the activation events include the command
17+ const activationEvents = packageJson . activationEvents ;
18+ expect ( activationEvents ) . to . include ( 'onCommand:python.configureTests' ) ;
19+ } ) ;
20+
21+ test ( 'python.configureTests command should be declared in contributes.commands' , ( ) => {
22+ // Read package.json from the project root
23+ const packageJsonPath = path . join ( __dirname , '..' , '..' , '..' , 'package.json' ) ;
24+ const packageJson = JSON . parse ( fs . readFileSync ( packageJsonPath , 'utf8' ) ) ;
25+
26+ // Verify that the command is declared in contributes.commands
27+ const commands = packageJson . contributes . commands ;
28+ const configureTestsCommand = commands . find ( ( cmd : any ) => cmd . command === 'python.configureTests' ) ;
29+ expect ( configureTestsCommand ) . to . not . be . undefined ;
30+ expect ( configureTestsCommand . category ) . to . equal ( 'Python' ) ;
31+ } ) ;
32+
33+ test ( 'Both configureTests and copilotSetupTests commands should have activation events' , ( ) => {
34+ // Read package.json from the project root
35+ const packageJsonPath = path . join ( __dirname , '..' , '..' , '..' , 'package.json' ) ;
36+ const packageJson = JSON . parse ( fs . readFileSync ( packageJsonPath , 'utf8' ) ) ;
37+
38+ // Verify both test-related commands have activation events
39+ const activationEvents = packageJson . activationEvents ;
40+ expect ( activationEvents ) . to . include ( 'onCommand:python.configureTests' ) ;
41+ expect ( activationEvents ) . to . include ( 'onCommand:python.copilotSetupTests' ) ;
42+ } ) ;
43+ } ) ;
0 commit comments