Last active
July 24, 2022 19:59
-
-
Save jbenner-radham/a4452dc03eaef1f3aeeecadf0b29ef87 to your computer and use it in GitHub Desktop.
VS Code code snippets for Mocha & Chai tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| /* vim: syntax=jsonc */ | |
| { | |
| // Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and | |
| // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope | |
| // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is | |
| // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
| // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. | |
| // Placeholders with the same ids are connected. | |
| // Example: | |
| // "Print to console": { | |
| // "scope": "javascript,typescript", | |
| // "prefix": "log", | |
| // "body": [ | |
| // "console.log('$1');", | |
| // "$2" | |
| // ], | |
| // "description": "Log output to console" | |
| // } | |
| "Mocha Describe": { | |
| "body": [ | |
| "describe('${1:scenario}', () => {", | |
| "\t${2:test}", | |
| "});" | |
| ], | |
| "description": "creates a describe block", | |
| "prefix": "md", | |
| "scope": "javascript,javascriptreact,typescript,typescriptreact" | |
| }, | |
| "Mocha Expect To Equal": { | |
| "body": "expect(${1:actual}).to.equal(${2:expected});", | |
| "description": "creates an expect to equal assertion", | |
| "prefix": "mete", | |
| "scope": "javascript,javascriptreact,typescript,typescriptreact" | |
| }, | |
| "Mocha It": { | |
| "body": [ | |
| "it('${1:scenario}', () => {", | |
| "\t${2:test}", | |
| "});" | |
| ], | |
| "description": "creates an it test", | |
| "prefix": "mi", | |
| "scope": "javascript,javascriptreact,typescript,typescriptreact" | |
| }, | |
| "Mocha It Is a Method": { | |
| "body": [ | |
| "it('is a method', () => {", | |
| "\texpect(${1:class}.prototype.${2:method}).to.be.a('function');", | |
| "});" | |
| ], | |
| "description": "creates an it is a method test", | |
| "prefix": "miam", | |
| "scope": "javascript,javascriptreact,typescript,typescriptreact" | |
| }, | |
| "Mocha It Returns a Boolean": { | |
| "body": [ | |
| "it('returns a boolean', () => {", | |
| "\texpect(${1:actual}).to.be.a('boolean');", | |
| "});" | |
| ], | |
| "description": "creates an it returns a boolean test", | |
| "prefix": "mrab", | |
| "scope": "javascript,javascriptreact,typescript,typescriptreact" | |
| }, | |
| "Mocha It Returns a String": { | |
| "body": [ | |
| "it('is returns a string', () => {", | |
| "\texpect(${1:actual}).to.be.a('string');", | |
| "});" | |
| ], | |
| "description": "creates an it returns a string test", | |
| "prefix": "mras", | |
| "scope": "javascript,javascriptreact,typescript,typescriptreact" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment