You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Describes how to create and register new commands
3
-
globs:
3
+
globs: src/command/*.ts
4
4
alwaysApply: false
5
5
---
6
-
- Commands are located in src/command directory
6
+
- Commands are located in `src/command` directory
7
7
- Commands must extend the [Command.ts](mdc:src/command/Command.ts) abstract class or any other class that inherits it
8
+
- Command name must be defined in format: `magentoToolbox.commandName`
8
9
- New commands must be added to [index.ts](mdc:src/command/index.ts) file so that they are loaded. Commands also need to be added to [package.json](mdc:package.json) under contributes -> commands
9
10
- Commands that only generate files based on a pre-defined template can extend the [SimpleTemplateGeneratorCommand.ts](mdc:src/command/SimpleTemplateGeneratorCommand.ts) class
- Utilities for tests can be found in this file [util.ts](mdc:src/test/util.ts)
8
+
- Some parts of the extension require the ExtensionContext to be present. To make sure it's set, tests should run the setup function from [setup.ts](mdc:src/test/setup.ts)
9
+
- Tests are written using Mocha framework (`mocha` package) in Typescript and must end with .test.ts file extension. Do NOT use `chai`
10
+
- Test spies, stubs and mocks can be written using the Sinon.js library
11
+
- Reference files for tests are stored in the test-resources directory
0 commit comments