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
@@ -21,35 +21,35 @@ While working on a project in my organization, We followed a pattern to keep tes
21
21
22
22
## How to use this extension?
23
23
24
-
Install and open [Visual Studio Code](https://code.visualstudio.com/). Press `Ctrl+Shift+X` or `Cmd+Shift+X` to open the Extensions pane. Type `create tests` in the search box and hit enter. You can also install the extension from the [Marketplace](https://marketplace.visualstudio.com/items?itemName=hardikmodha.create-tests). Currently, It supports Typescript and Javascript files. (Supported file extensions: `.ts`, `.tsx`, `.js`, `.jsx`)
24
+
Install and open [Visual Studio Code](https://code.visualstudio.com/). Press `Ctrl+Shift+X` or `Cmd+Shift+X` to open the Extensions pane. Type `create tests` in the search box and hit enter. You can also install the extension from the [Marketplace](https://marketplace.visualstudio.com/items?itemName=hardikmodha.file-generator). Currently, It supports Typescript and Javascript files. (Supported file extensions: `.ts`, `.tsx`, `.js`, `.jsx`)
|`testRunner.defaultLocationForFiles`| string |`same location as source file`| 1. `same location as source file`, 2. `project root`| Location where you want to keep the test files. |
33
-
|`testRunner.sourceDir`| string |`src`| any string value | Name of directory which contains all source files. This directory is not created when generating the directory structure for the test file. |
34
-
|`testRunner.directoryName`| string |`tests`| any string value (allows empty string) | Name of the directory which should contain all the test files. If this config option value is set to an empty string then it keeps the test file next to the source file. |
35
-
|`testRunner.customLocationForFiles`| string | - | any valid path | Set this property in case you want to specify the custom location for test files. |
36
-
|`testRunner.filesSuffix`| string | 'test' | any string value | Suffix to append for every created test file |
37
-
|`testRunner.shouldSwitchToFile`| boolean | true | true \| false | Whether to switch to the created test file or not |
38
-
|`testRunner.template.default`| array \| object |`["import {${moduleName}} from '${modulePath}';"]`| any string array or object | Default template to use for all test file |
39
-
|`testRunner.template.*`| array \| object | - | string array or object | Language specific templates that you want to use. |
|`fileGenerator.defaultLocationForFiles`| string |`same location as source file`| 1. `same location as source file`, 2. `project root`| Location where you want to keep the test files. |
33
+
|`fileGenerator.sourceDir`| string |`src`| any string value | Name of directory which contains all source files. This directory is not created when generating the directory structure for the test file. |
34
+
|`fileGenerator.directoryName`| string |`tests`| any string value (allows empty string) | Name of the directory which should contain all the test files. If this config option value is set to an empty string then it keeps the test file next to the source file. |
35
+
|`fileGenerator.customLocationForFiles`| string | - | any valid path | Set this property in case you want to specify the custom location for test files. |
36
+
|`fileGenerator.filesSuffix`| string | 'test' | any string value | Suffix to append for every created test file |
37
+
|`fileGenerator.shouldSwitchToFile`| boolean | true | true \| false | Whether to switch to the created test file or not |
38
+
|`fileGenerator.template.default`| array \| object |`["import {${moduleName}} from '${modulePath}';"]`| any string array or object | Default template to use for all test file |
39
+
|`fileGenerator.template.*`| array \| object | - | string array or object | Language specific templates that you want to use. |
40
40
41
41
## Template types
42
42
43
43
Templates are used to initialize test files with default content. It eases the task and removes boilerplate code. Following template types are supported.
44
44
45
45
### 1. Default template
46
46
47
-
The default template for any file can be specified by overriding the configuration `testRunner.template.default`.
47
+
The default template for any file can be specified by overriding the configuration `fileGenerator.template.default`.
48
48
Default value for this template is: `"import ${moduleName} from '${modulePath}';"` Here, `moduleName` and `modulePath` are special placeholders, which gets replaces with the source file name and the relative path to the source file respectively.
49
49
50
50
### 2. Language-specific templates
51
51
52
-
When creating the test files, this extension reads the configuration for the template specified by `testRunner.template.<file-extension>`. So if your file name is `MyFile.js` then the extension will read the configuration `testRunner.template.js` for the template. If it finds one then it will write the content of the template into the created test file.
52
+
When creating the test files, this extension reads the configuration for the template specified by `fileGenerator.template.<file-extension>`. So if your file name is `MyFile.js` then the extension will read the configuration `fileGenerator.template.js` for the template. If it finds one then it will write the content of the template into the created test file.
53
53
54
54
**Note**: Language-specific templates have higher priority over the default template.
0 commit comments