Skip to content

Instantly share code, notes, and snippets.

@rgrove
Created January 31, 2017 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgrove/cfa8a4867c275186bc9c87d9b9bde2ed to your computer and use it in GitHub Desktop.
Save rgrove/cfa8a4867c275186bc9c87d9b9bde2ed to your computer and use it in GitHub Desktop.
Atom snippets for writing Mocha tests
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
# '.source.coffee':
# 'Console log':
# 'prefix': 'log'
# 'body': 'console.log $1'
#
# -- JavaScript ----------------------------------------------------------------
'.source.js':
# -- Mocha -------------------------------------------------------------------
'Mocha: after()':
'prefix': 'a'
'body': """
after((${1:done}) => {
$2
});
"""
'Mocha: afterEach()':
'prefix': 'ae'
'body': """
afterEach((${1:done}) => {
$2
});
"""
'Mocha: before()':
'prefix': 'b'
'body': """
before((${1:done}) => {
$2
});
"""
'Mocha: beforeEach()':
'prefix': 'be'
'body': """
beforeEach((${1:done}) => {
$2
});
"""
'Mocha: describe()':
'prefix': 'desc'
'body': """
describe("$1", () => {
$2
});
"""
'Mocha: it()':
'prefix': 'it'
'body': """
it("$1", (${2:done}) => {
${3:throw new Error("Empty test.");}
});
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment