├── .gitignore
├── snippets
├── js2-mode
│ └── .yas-parents
└── js-mode
│ ├── assert.yasnippet
│ ├── refute.yasnippet
│ ├── assert.called.yasnippet
│ ├── assert.isNaN.yasnippet
│ ├── assert.isNull.yasnippet
│ ├── refute.called.yasnippet
│ ├── refute.isNaN.yasnippet
│ ├── refute.isNull.yasnippet
│ ├── assert.defined.yasnippet
│ ├── assert.isArray.yasnippet
│ ├── refute.defined.yasnippet
│ ├── refute.isArray.yasnippet
│ ├── assert.calledOnce.yasnippet
│ ├── assert.isBoolean.yasnippet
│ ├── assert.isNumber.yasnippet
│ ├── assert.isObject.yasnippet
│ ├── assert.isString.yasnippet
│ ├── assert.match.yasnippet
│ ├── assert.same.yasnippet
│ ├── assert.threw.yasnippet
│ ├── refute.calledOnce.yasnippet
│ ├── refute.isBoolean.yasnippet
│ ├── refute.isNumber.yasnippet
│ ├── refute.isObject.yasnippet
│ ├── refute.isString.yasnippet
│ ├── refute.match.yasnippet
│ ├── refute.same.yasnippet
│ ├── refute.threw.yasnippet
│ ├── assert.calledOn.yasnippet
│ ├── assert.calledThrice.yasnippet
│ ├── assert.calledTwice.yasnippet
│ ├── assert.equals.yasnippet
│ ├── assert.isFunction.yasnippet
│ ├── assert.typeOf.yasnippet
│ ├── refute.calledOn.yasnippet
│ ├── refute.calledThrice.yasnippet
│ ├── refute.calledTwice.yasnippet
│ ├── refute.equals.yasnippet
│ ├── refute.isFunction.yasnippet
│ ├── refute.typeOf.yasnippet
│ ├── assert.callCount.yasnippet
│ ├── assert.isArrayLike.yasnippet
│ ├── assert.tagName.yasnippet
│ ├── refute.callCount.yasnippet
│ ├── refute.exception.yasnippet
│ ├── refute.isArrayLike.yasnippet
│ ├── refute.tagName.yasnippet
│ ├── assert.callOrder.yasnippet
│ ├── assert.calledWith.yasnippet
│ ├── assert.exception.yasnippet
│ ├── refute.callOrder.yasnippet
│ ├── refute.calledWith.yasnippet
│ ├── assert.alwaysThrew.yasnippet
│ ├── assert.className.yasnippet
│ ├── assert.inDelta.yasnippet
│ ├── refute.alwaysThrew.yasnippet
│ ├── refute.className.yasnippet
│ ├── refute.inDelta.yasnippet
│ ├── assert.alwaysCalledOn.yasnippet
│ ├── assert.calledOnceWith.yasnippet
│ ├── refute.alwaysCalledOn.yasnippet
│ ├── refute.calledOnceWith.yasnippet
│ ├── assert.alwaysCalledWith.yasnippet
│ ├── refute.alwaysCalledWith.yasnippet
│ ├── assert.calledWithExactly.yasnippet
│ ├── buster.setUp.yasnippet
│ ├── refute.calledWithExactly.yasnippet
│ ├── buster.tearDown.yasnippet
│ ├── buster.nestedContext.yasnippet
│ ├── assert.alwaysCalledWithExactly.yasnippet
│ ├── refute.alwaysCalledWithExactly.yasnippet
│ ├── buster.test.yasnippet
│ ├── buster.testCase.browser.yasnippet
│ ├── buster.testCase.node.yasnippet
│ └── buster.testCase.mixed.yasnippet
├── README.md
├── buster-snippet-helpers.el
└── buster-snippets.el
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
--------------------------------------------------------------------------------
/snippets/js2-mode/.yas-parents:
--------------------------------------------------------------------------------
1 | js-mode
--------------------------------------------------------------------------------
/snippets/js-mode/assert.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert
3 | # key: as
4 | # --
5 | assert($0);
--------------------------------------------------------------------------------
/snippets/js-mode/refute.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute
3 | # key: re
4 | # --
5 | refute($0);
--------------------------------------------------------------------------------
/snippets/js-mode/assert.called.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.called
3 | # key: asc
4 | # --
5 | assert.called(${1:spy});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.isNaN.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.isNaN
3 | # key: asin
4 | # --
5 | assert.isNaN(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.isNull.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.isNull
3 | # key: asin
4 | # --
5 | assert.isNull(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.called.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.called
3 | # key: rec
4 | # --
5 | refute.called(${1:spy});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.isNaN.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.isNaN
3 | # key: rein
4 | # --
5 | refute.isNaN(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.isNull.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.isNull
3 | # key: rein
4 | # --
5 | refute.isNull(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.defined.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.defined
3 | # key: asd
4 | # --
5 | assert.defined(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.isArray.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.isArray
3 | # key: asia
4 | # --
5 | assert.isArray(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.defined.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.defined
3 | # key: red
4 | # --
5 | refute.defined(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.isArray.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.isArray
3 | # key: reia
4 | # --
5 | refute.isArray(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.calledOnce.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.calledOnce
3 | # key: asc1
4 | # --
5 | assert.calledOnce(${1:spy});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.isBoolean.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.isBoolean
3 | # key: asib
4 | # --
5 | assert.isBoolean(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.isNumber.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.isNumber
3 | # key: asin
4 | # --
5 | assert.isNumber(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.isObject.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.isObject
3 | # key: asio
4 | # --
5 | assert.isObject(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.isString.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.isString
3 | # key: asis
4 | # --
5 | assert.isString(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.match.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.match
3 | # key: asm
4 | # --
5 | assert.match(${1:actual}, ${2:matcher});
--------------------------------------------------------------------------------
/snippets/js-mode/assert.same.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.same
3 | # key: ass
4 | # --
5 | assert.same(${1:actual}, ${2:expected});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.threw.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.threw
3 | # key: ast
4 | # --
5 | assert.threw(${1:spy}, ${2:exception});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.calledOnce.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.calledOnce
3 | # key: rec1
4 | # --
5 | refute.calledOnce(${1:spy});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.isBoolean.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.isBoolean
3 | # key: reib
4 | # --
5 | refute.isBoolean(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.isNumber.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.isNumber
3 | # key: rein
4 | # --
5 | refute.isNumber(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.isObject.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.isObject
3 | # key: reio
4 | # --
5 | refute.isObject(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.isString.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.isString
3 | # key: reis
4 | # --
5 | refute.isString(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.match.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.match
3 | # key: rem
4 | # --
5 | refute.match(${1:actual}, ${2:matcher});
--------------------------------------------------------------------------------
/snippets/js-mode/refute.same.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.same
3 | # key: res
4 | # --
5 | refute.same(${1:expected}, ${2:actual});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.threw.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.threw
3 | # key: ret
4 | # --
5 | refute.threw(${1:spy}, ${2:exception});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.calledOn.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.calledOn
3 | # key: asco
4 | # --
5 | assert.calledOn(${1:spy}, ${2:obj});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.calledThrice.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.calledThrice
3 | # key: asc3
4 | # --
5 | assert.calledThrice(${1:spy});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.calledTwice.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.calledTwice
3 | # key: asc2
4 | # --
5 | assert.calledTwice(${1:spy});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.equals.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.equals
3 | # key: ase
4 | # --
5 | assert.equals(${1:actual}, ${2:expected});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.isFunction.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.isFunction
3 | # key: asif
4 | # --
5 | assert.isFunction(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.typeOf.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.typeOf
3 | # key: asto
4 | # --
5 | assert.typeOf(${1:object}, ${2:expected});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.calledOn.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.calledOn
3 | # key: reco
4 | # --
5 | refute.calledOn(${1:spy}, ${2:obj});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.calledThrice.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.calledThrice
3 | # key: rec3
4 | # --
5 | refute.calledThrice(${1:spy});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.calledTwice.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.calledTwice
3 | # key: rec2
4 | # --
5 | refute.calledTwice(${1:spy});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.equals.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.equals
3 | # key: ree
4 | # --
5 | refute.equals(${1:actual}, ${2:expected});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.isFunction.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.isFunction
3 | # key: reif
4 | # --
5 | refute.isFunction(${1:object});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.typeOf.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.typeOf
3 | # key: reto
4 | # --
5 | refute.typeOf(${1:object}, ${2:expected});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.callCount.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.callCount
3 | # key: ascc
4 | # --
5 | assert.callCount(${1:spy}, ${2:count});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.isArrayLike.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.isArrayLike
3 | # key: asial
4 | # --
5 | assert.isArrayLike(${1:actual});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.tagName.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.tagName
3 | # key: astn
4 | # --
5 | assert.tagName(${1:element}, "${2:tagName}");$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.callCount.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.callCount
3 | # key: recc
4 | # --
5 | refute.callCount(${1:spy}, ${2:count});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.exception.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.exception
3 | # key: rex
4 | # --
5 | refute.exception(f$0${1:, "${2:type}"});
--------------------------------------------------------------------------------
/snippets/js-mode/refute.isArrayLike.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.isArrayLike
3 | # key: reial
4 | # --
5 | refute.isArrayLike(${1:actual});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.tagName.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.tagName
3 | # key: retn
4 | # --
5 | refute.tagName(${1:element}, "${2:tagName}");$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.callOrder.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.callOrder
3 | # key: asco
4 | # --
5 | assert.callOrder(${1:spy1}, ${2:spy2, ...});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.calledWith.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.calledWith
3 | # key: ascw
4 | # --
5 | assert.calledWith(${1:spy}, ${2:arguments});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.exception.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.exception
3 | # key: asx
4 | # --
5 | assert.exception(function () {
6 | $0
7 | });
--------------------------------------------------------------------------------
/snippets/js-mode/refute.callOrder.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.callOrder
3 | # key: reco
4 | # --
5 | refute.callOrder(${1:spy}1, ${1:spy2, ...});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.calledWith.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.calledWith
3 | # key: recw
4 | # --
5 | refute.calledWith(${1:spy}, ${2:arguments});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.alwaysThrew.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.alwaysThrew
3 | # key: asat
4 | # --
5 | assert.alwaysThrew(${1:spy}, ${2:exception});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.className.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.className
3 | # key: ascn
4 | # --
5 | assert.className(${1:element}, "${2:className}");$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.inDelta.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.inDelta
3 | # key: asid
4 | # --
5 | assert.inDelta(${1:actual}, ${2:expected}, ${3:delta});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.alwaysThrew.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.alwaysThrew
3 | # key: reat
4 | # --
5 | refute.alwaysThrew(${1:spy}, ${2:exception});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.className.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.className
3 | # key: recn
4 | # --
5 | refute.className(${1:element}, "${2:tagName}");$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.inDelta.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.inDelta
3 | # key: reid
4 | # --
5 | refute.inDelta(${1:actual}, ${2:expected}, ${3:delta});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.alwaysCalledOn.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.alwaysCalledOn
3 | # key: asaco
4 | # --
5 | assert.alwaysCalledOn(${1:spy}, ${2:obj});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.calledOnceWith.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.calledOnceWith
3 | # key: asc1w
4 | # --
5 | assert.calledOnceWith(${1:spy}, ${2:arg});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.alwaysCalledOn.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.alwaysCalledOn
3 | # key: reaco
4 | # --
5 | refute.alwaysCalledOn(${1:spy}, ${2:obj});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.calledOnceWith.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.calledOnceWith
3 | # key: rec1w
4 | # --
5 | refute.calledOnceWith(${1:spy}, ${2:arg});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.alwaysCalledWith.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.alwaysCalledWith
3 | # key: asacw
4 | # --
5 | assert.alwaysCalledWith(${1:spy}, ${2:arguments});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.alwaysCalledWith.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.alwaysCalledWith
3 | # key: reacw
4 | # --
5 | refute.alwaysCalledWith(${1:spy}, ${2:arguments});$0
--------------------------------------------------------------------------------
/snippets/js-mode/assert.calledWithExactly.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.calledWithExactly
3 | # key: ascwe
4 | # --
5 | assert.calledWithExactly(${1:spy}, ${2:arguments});$0
--------------------------------------------------------------------------------
/snippets/js-mode/buster.setUp.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: setUp
3 | # key: su
4 | # --
5 | setUp: function () {
6 | $0
7 | }`(comma-if-looking-at-whitespace-and-quotes)`
8 |
--------------------------------------------------------------------------------
/snippets/js-mode/refute.calledWithExactly.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.calledWithExactly
3 | # key: recwe
4 | # --
5 | refute.calledWithExactly(${1:spy}, ${2:arguments});$0
--------------------------------------------------------------------------------
/snippets/js-mode/buster.tearDown.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: tearDown
3 | # key: td
4 | # --
5 | tearDown: function () {
6 | $0
7 | }`(comma-if-looking-at-whitespace-and-quotes)`
8 |
--------------------------------------------------------------------------------
/snippets/js-mode/buster.nestedContext.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: buster.nestedContext
3 | # key: cx
4 | # --
5 | "${1:context}": {
6 | tt$0
7 | }`(comma-if-looking-at-whitespace-and-quotes)`
--------------------------------------------------------------------------------
/snippets/js-mode/assert.alwaysCalledWithExactly.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: assert.alwaysCalledWithExactly
3 | # key: asacwe
4 | # --
5 | assert.alwaysCalledWithExactly(${1:spy}, ${2:arguments});$0
--------------------------------------------------------------------------------
/snippets/js-mode/refute.alwaysCalledWithExactly.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: refute.alwaysCalledWithExactly
3 | # key: reacwe
4 | # --
5 | refute.alwaysCalledWithExactly(${1:spy}, ${2:arguments});$0
--------------------------------------------------------------------------------
/snippets/js-mode/buster.test.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: buster.test
3 | # key: tt
4 | # --
5 | "`buster-test-prefix`${1:do stuff}": function () {
6 | $0
7 | }`(comma-if-looking-at-whitespace-and-quotes)`
--------------------------------------------------------------------------------
/snippets/js-mode/buster.testCase.browser.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: buster.testCase.browser
3 | # key: tc
4 | # condition: buster-testcase-snippets-enabled
5 | # --
6 | (function (${3:${2:$(buster--shortcuts-for-globals yas/text)}}) {
7 | `(buster--maybe-use-strict)
8 | ``(buster--maybe-add-local-asserts)
9 | `buster.testCase("${1:`(chop-suffix "Test" (buffer-file-name-body))`}", {
10 | tt$0
11 | });
12 | }(${2:`(if buster-add-default-global-to-iife buster-default-global)`}));
--------------------------------------------------------------------------------
/snippets/js-mode/buster.testCase.node.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: buster.testCase.node
3 | # key: tc
4 | # condition: buster-testcase-snippets-enabled
5 | # --
6 | `(buster--maybe-use-strict)
7 | `var buster = require("buster");
8 | `(buster--maybe-add-local-asserts)
9 | `var ${4:${2:$(lower-camel-case (file-name-nondirectory yas/text))}} = require("${1:`(buster--guess-lib-folder)`}${2:`(chop-test-suffix (buffer-file-name-body))`}")$3;
10 |
11 | buster.testCase("${5:${2:$(capitalized-words (file-name-nondirectory yas/text))`}}", {
12 | tt$0
13 | });
14 |
--------------------------------------------------------------------------------
/snippets/js-mode/buster.testCase.mixed.yasnippet:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: buster.testCase.mixed
3 | # key: tc
4 | # condition: buster-testcase-snippets-enabled
5 | # --
6 | if (typeof require === "function" && typeof module !== "undefined") {
7 | var buster = require("buster");
8 | var ${5:`buster-default-global`} = { ${4:${2:$(lower-camel-case (file-name-nondirectory yas/text))}}: require("${1:`(buster--guess-lib-folder)`}${2:`(chop-test-suffix (buffer-file-name-body))`}")$3 };
9 | }
10 |
11 | (function (${8:${7:$(buster--shortcuts-for-globals yas/text)}}) {
12 | `(buster--maybe-use-strict)
13 | ``(buster--maybe-add-local-asserts)
14 | `buster.testCase("${6:${2:$(capitalized-words (file-name-nondirectory yas/text))}}", {
15 | tt$0
16 | });
17 | }(${7:${5:$(if buster-add-default-global-to-iife yas/text)})));
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # buster-snippets.el
2 |
3 | Yasnippets for the [Buster javascript testing framework](http://busterjs.org).
4 |
5 | ## Common snippets
6 |
7 | tc => new testCase (one for node, browser and node+browser)
8 | tt => additional test
9 | cx => nested context
10 | su => setup method
11 | td => teardown method
12 |
13 | Assert and refute snippets follow a common pattern. They start with `as` or `re`
14 | followed by a mnemonic shortcut. Most are simply the 'initials' of the method name, but
15 | the best shortcuts are saved for the most common assertions.
16 |
17 | ase - assert.equals
18 | asm - assert.match
19 | ass - assert.same
20 | asx - assert.exception
21 | asd - assert.defined
22 | ast - assert.threw
23 | asat - assert.alwaysThrew
24 | asin - assert.isNull
25 | asio - assert.isObject
26 | asto - assert.typeOf
27 | ascn - assert.className
28 | astn - assert.tagName
29 |
30 | Buster also includes Sinon and its assertions:
31 |
32 | asc - assert.called
33 | asc1 - assert.calledOnce
34 | asc2 - assert.calledTwice
35 | asc3 - assert.calledThrice
36 | ascw - assert.calledWith
37 | ascc - assert.callCount
38 | asco - assert.callOrder
39 | asco - assert.calledOn
40 | asaco - assert.alwaysCalledOn
41 | asacw - assert.alwaysCalledWith
42 | asacwe - assert.alwaysCalledWithExactly
43 | ascwe - assert.calledWithExactly
44 |
45 | Refutations mirrors assertions exactly, except that they start with `re` instead of
46 | `as`. It is the beautiful symmetry of the buster assertions package.
47 |
48 | ## Installation
49 |
50 | If you haven't, install [yasnippet](http://capitaomorte.github.com/yasnippet/)
51 | then install buster-snippets like so:
52 |
53 | git submodule add https://github.com/magnars/buster-snippets.el.git site-lisp/buster-snippets
54 |
55 | Then require buster-snippets at some point after yasnippet.
56 |
57 | (require 'buster-snippets)
58 |
59 | ## Customization
60 |
61 | Add `"use strict"`-declarations to the test cases:
62 |
63 | (setq buster-use-strict t)
64 |
65 | Declare `assert` and `refute` if you've disabled additional globals:
66 |
67 | (setq buster-exposed-asserts nil)
68 |
69 | Set the default global namespace-object on a per-project basis:
70 |
71 | (add-hook 'js2-mode-hook
72 | (lambda ()
73 | (when (string-match-p "projects/zombietdd" (buffer-file-name))
74 | (setq js2-additional-externs '("ZOMBIE"))
75 | (setq buster-default-global "ZOMBIE"))))
76 |
77 | ;; example from one of my projects
78 |
79 | Add the default global to the IIFE (immediately invoked function expression)
80 |
81 | (setq buster-add-default-global-to-iife t)
82 |
83 | The global will by default be shortened to a one-letter var, like this:
84 |
85 | (function (Z) {
86 |
87 | // use Z instead of ZOMBIE inside the namespace
88 |
89 | }(ZOMBIE));
90 |
91 | ## License
92 |
93 | Copyright (C) 2011 Magnar Sveen
94 |
95 | This program is free software; you can redistribute it and/or modify
96 | it under the terms of the GNU General Public License as published by
97 | the Free Software Foundation, either version 3 of the License, or
98 | (at your option) any later version.
99 |
100 | This program is distributed in the hope that it will be useful,
101 | but WITHOUT ANY WARRANTY; without even the implied warranty of
102 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
103 | GNU General Public License for more details.
104 |
105 | You should have received a copy of the GNU General Public License
106 | along with this program. If not, see .
107 |
--------------------------------------------------------------------------------
/buster-snippet-helpers.el:
--------------------------------------------------------------------------------
1 | ;;; buster-snippet-helpers.el --- Making snippet code look snazzy since 2011
2 |
3 | ;; Copyright (C) 2011 Magnar Sveen
4 |
5 | ;; Author: Magnar Sveen
6 | ;; Keywords: snippets
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; Helper methods used in buster-snippets
24 |
25 | ;;; Code:
26 |
27 | (defun chop-suffix (suffix s)
28 | "Remove string 'suffix' if it is at end of string 's'"
29 | (let ((pos (- (length suffix))))
30 | (if (and (>= (length s) (length suffix))
31 | (string= suffix (substring s pos)))
32 | (substring s 0 pos)
33 | s)))
34 |
35 | (defun chop-test-suffix (s)
36 | "Remove -test or _test from end of S"
37 | (chop-suffix "-test" (chop-suffix "_test" s)))
38 |
39 | (defun buffer-file-name-body ()
40 | "Buffer file name stripped of directory and extension"
41 | (if (buffer-file-name)
42 | (file-name-nondirectory (file-name-sans-extension (buffer-file-name)))
43 | (cadr (reverse (split-string (dired-current-directory) "/")))))
44 |
45 | (defun split-name (s)
46 | "Split name into list of words"
47 | (split-string
48 | (let ((case-fold-search nil))
49 | (downcase
50 | (replace-regexp-in-string "\\([a-z]\\)\\([A-Z]\\)" "\\1 \\2" s)))
51 | "[^A-Za-z0-9]+"))
52 |
53 | (defun mapcar-head (fn-head fn-rest list)
54 | "Like MAPCAR, but applies a different function to the first element."
55 | (if list
56 | (cons (funcall fn-head (car list)) (mapcar fn-rest (cdr list)))))
57 |
58 | (defun lower-camel-case (s)
59 | "Convert string 's' to camelCase string."
60 | (mapconcat 'identity (mapcar-head
61 | (lambda (word) (downcase word))
62 | (lambda (word) (capitalize (downcase word)))
63 | (split-name s)) ""))
64 |
65 | (defun upper-camel-case (s)
66 | "Convert string 's' to CamelCase string."
67 | (mapconcat 'identity (mapcar
68 | (lambda (word) (capitalize (downcase word)))
69 | (split-name s)) ""))
70 |
71 | (defun snake-case (s)
72 | "Convert string 's' to snake_case string."
73 | (mapconcat 'identity (mapcar
74 | (lambda (word) (downcase word))
75 | (split-name s)) "_"))
76 |
77 | (defun capitalized-words (s)
78 | "Convert string 's' to Capitalized Words string."
79 | (mapconcat 'identity (mapcar
80 | (lambda (word) (capitalize (downcase word)))
81 | (split-name s)) " "))
82 |
83 | (defun comma-if-looking-at-whitespace-and-quotes ()
84 | (if (looking-at "\\(\\s \\|\n\\)+\"") "," ""))
85 |
86 | ;; Guess lib-folder
87 | (defun buster--guess-lib-folder ()
88 | (if (buffer-file-name)
89 | (let ((test-dir (file-name-directory (buffer-file-name))))
90 | (if (string-match-p "/test/" test-dir)
91 | (let ((lib-dir (buster--lib-folder-with-same-nesting test-dir)))
92 | (if (file-exists-p lib-dir) lib-dir))))))
93 |
94 | (defun buster--lib-folder-with-same-nesting (test-dir)
95 | (let ((lib-dir (replace-regexp-in-string ".+/test/\\(.*\\)" "lib/\\1" test-dir)))
96 | (concat (buster--path-out-of-test lib-dir) lib-dir)))
97 |
98 | (defun buster--path-out-of-test (lib-dir)
99 | (mapconcat 'identity (mapcar
100 | (lambda (word) "../")
101 | (split-string lib-dir "/" t)) ""))
102 |
103 | ;; Shortcut globals for iife
104 | (defun buster--shortcuts-for-globals (globals)
105 | (mapconcat 'identity (mapcar
106 | 'buster--global-shortcut
107 | (buster--params globals)) ", "))
108 |
109 | (defun buster--last-word (s)
110 | (car (last (split-string s "\\." t))))
111 |
112 | (defun buster--first-char (s)
113 | (car (split-string s "" t)))
114 |
115 | (defun buster--global-shortcut (s)
116 | (if (string-match-p "jquery" s)
117 | "$"
118 | (upcase (buster--first-char (buster--last-word s)))))
119 |
120 | (defun buster--params (s)
121 | (split-string s "[, ]" t))
122 |
123 | ;; Maybe use strict
124 | (defun buster--maybe-use-strict ()
125 | (if buster-use-strict
126 | "\"use strict\";\n\n"
127 | ""))
128 |
129 | ;; Maybe add local asserts
130 | (defun buster--maybe-add-local-asserts ()
131 | (if (not buster-exposed-asserts)
132 | "var assert = buster.assert;\nvar refute = buster.refute;\n\n"
133 | ""))
134 |
135 | (provide 'buster-snippet-helpers)
136 | ;;; buster-snippet-helpers.el ends here
137 |
--------------------------------------------------------------------------------
/buster-snippets.el:
--------------------------------------------------------------------------------
1 | ;;; buster-snippets.el --- Yasnippets for the Buster javascript testing framework
2 |
3 | ;; Copyright (C) 2011 Magnar Sveen
4 |
5 | ;; Author: Magnar Sveen
6 | ;; Keywords: snippets
7 | ;; Package-Requires: ((yasnippet "0.8.0"))
8 |
9 | ;; This program is free software; you can redistribute it and/or modify
10 | ;; it under the terms of the GNU General Public License as published by
11 | ;; the Free Software Foundation, either version 3 of the License, or
12 | ;; (at your option) any later version.
13 |
14 | ;; This program is distributed in the hope that it will be useful,
15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | ;; GNU General Public License for more details.
18 |
19 | ;; You should have received a copy of the GNU General Public License
20 | ;; along with this program. If not, see .
21 |
22 | ;;; Commentary:
23 |
24 | ;; Yasnippets for the Buster javascript testing framework
25 | ;;
26 | ;; Common snippets
27 | ;;
28 | ;; tc => new testCase (one for node, browser and node+browser)
29 | ;; tt => additional test
30 | ;; cx => nested context
31 | ;; su => setup method
32 | ;; td => teardown method
33 | ;;
34 | ;; Assert and refute snippets follow a common pattern. They start with `as` or `re`
35 | ;; followed by a mnemonic shortcut. Most are simply the 'initials' of the method name, but
36 | ;; the best shortcuts are saved for the most common assertions.
37 | ;;
38 | ;; ase - assert.equals
39 | ;; asm - assert.match
40 | ;; ass - assert.same
41 | ;; asx - assert.exception
42 | ;; asd - assert.defined
43 | ;; ast - assert.threw
44 | ;; asat - assert.alwaysThrew
45 | ;; asin - assert.isNull
46 | ;; asio - assert.isObject
47 | ;; asto - assert.typeOf
48 | ;; ascn - assert.className
49 | ;; astn - assert.tagName
50 | ;;
51 | ;; Buster also includes Sinon and its assertions:
52 | ;;
53 | ;; asc - assert.called
54 | ;; asc1 - assert.calledOnce
55 | ;; asc1w - assert.calledOnceWith
56 | ;; asc2 - assert.calledTwice
57 | ;; asc3 - assert.calledThrice
58 | ;; ascw - assert.calledWith
59 | ;; ascc - assert.callCount
60 | ;; asco - assert.callOrder
61 | ;; asco - assert.calledOn
62 | ;; asaco - assert.alwaysCalledOn
63 | ;; asacw - assert.alwaysCalledWith
64 | ;; asacwe - assert.alwaysCalledWithExactly
65 | ;; ascwe - assert.calledWithExactly
66 | ;;
67 | ;; Refutations mirrors assertions exactly, except that they start with `re` instead of
68 | ;; `as`. It is the beautiful symmetry of the buster assertions package.
69 |
70 | ;; Installation
71 |
72 | ;; If you haven't, install [yasnippet](http://capitaomorte.github.com/yasnippet/)
73 | ;; then install buster-snippets like so:
74 | ;;
75 | ;; git submodule add https://github.com/magnars/buster-snippets.el.git site-lisp/buster-snippets
76 | ;;
77 | ;; Then require buster-snippets at some point after yasnippet.
78 | ;;
79 | ;; (require 'buster-snippets)
80 |
81 | ;; Customization
82 |
83 | ;; Add `"use strict"`-declarations to the test cases:
84 | ;;
85 | ;; (setq buster-use-strict t)
86 | ;;
87 | ;; Declare `assert` and `refute` if you've disabled additional globals:
88 | ;;
89 | ;; (setq buster-exposed-asserts nil)
90 | ;;
91 | ;; Set the default global namespace-object on a per-project basis:
92 | ;;
93 | ;; (add-hook 'js2-mode-hook
94 | ;; (lambda ()
95 | ;; (when (string-match-p "projects/zombietdd" (buffer-file-name))
96 | ;; (setq js2-additional-externs '("ZOMBIE"))
97 | ;; (setq buster-default-global "ZOMBIE"))))
98 | ;;
99 | ;; ;; example from one of my projects
100 | ;;
101 | ;; Add the default global to the IIFE (immediately invoked function expression)
102 | ;;
103 | ;; (setq buster-add-default-global-to-iife t)
104 | ;;
105 | ;; The global will by default be shortened to a one-letter var, like this:
106 | ;;
107 | ;; (function (Z) {
108 | ;;
109 | ;; // use Z instead of ZOMBIE inside the namespace
110 | ;;
111 | ;; }(ZOMBIE));
112 |
113 | ;;; Code:
114 |
115 | (require 'yasnippet)
116 |
117 | (defgroup buster-snippets nil
118 | "Yasnippets for the Buster javascript testing framework."
119 | :group 'yasnippet)
120 |
121 | (defcustom buster-use-strict nil
122 | "On non-nil value, add strict-declarations to test cases.")
123 |
124 | (defcustom buster-exposed-asserts t
125 | "On nil value, declare assert and refute in local scope.")
126 |
127 | (defcustom buster-add-default-global-to-iife nil
128 | "On non-nil value, add the default global to the wrapping iife
129 | (immediately invoked function expression)")
130 |
131 | (defcustom buster-test-prefix ""
132 | "The default buster test prefix.")
133 |
134 | (defcustom buster-default-global "GLOBAL"
135 | "The default suggested global namespace-object.")
136 | (make-variable-buffer-local 'buster-default-global)
137 |
138 | (defcustom buster-testcase-snippets-enabled t
139 | "A buffer local way of turning off the testCase snippets.
140 | To let you define your own testCase snippets for other
141 | frameworks while still using the buster-assertions package.")
142 | (make-variable-buffer-local 'buster-testcase-snippets-enabled)
143 |
144 | (require 'buster-snippet-helpers)
145 |
146 | (defvar buster-snippets-root (file-name-directory (or load-file-name
147 | (buffer-file-name))))
148 |
149 | ;;;###autoload
150 | (defun buster-snippets-initialize ()
151 | (let ((snip-dir (expand-file-name "snippets" buster-snippets-root)))
152 | (when (boundp 'yas-snippet-dirs)
153 | (add-to-list 'yas-snippet-dirs snip-dir t))
154 | (yas-load-directory snip-dir)))
155 |
156 | ;;;###autoload
157 | (eval-after-load "yasnippet"
158 | '(buster-snippets-initialize))
159 |
160 | (provide 'buster-snippets)
161 | ;;; buster-snippets.el ends here
162 |
--------------------------------------------------------------------------------