When writing Jasmine unit tests in WebStorm (11.0.2), using the Command + N (OS X) command gives me the following popup menu:
Generate
I'd like to modify the code these menu items generate. For example, I'm using ES6, and would like to change the Jasmine Suite option to generate:
describe('suite name', () => {
});
Instead of:
describe('suite name', function () {
});
I'm digging through the WebStorm Preferences, but can't see any options to modify this. Any ideas?
I still haven't found a way to edit the code template when using Command-N keyboard shortcut, but similar functionality can be found using a "Live Template", giving you complete control of the template.
Navigate to:
Preferences -> Editor -> Live Templates
Select the JavaScript option in the right pane, and then the + icon to add a template.
Configuration Values:
Abbreviation: desc
Description: Jasmine Suite
Template Text:
describe('$SUITE_DESC$', () => {
$END$
});
Typing 'desc' then Tab, will generate the template. From there, you can add additional live templates for 'it', 'beforeEach' and 'afterEach', using the same approach.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With