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
| require("sinon-nodeunit"); | |
| exports.testSomething = function (test) { | |
| test.expect(1); | |
| test.ok(true, "this assertion should pass"); | |
| test.done(); | |
| }; | |
| exports.testSomethingElse = function (test) { | |
| test.ok(false, "this assertion should fail"); |
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
| (add-to-list 'load-path "/path/to/buster-mode") | |
| (autoload 'buster-mode "buster-mode") | |
| (add-hook 'find-file-hook | |
| (lambda () | |
| (let* ((file (buffer-file-name)) | |
| (len (length file))) | |
| (if (equal (substring file (- len 7) len) "test.js") (buster-mode))))) |
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
| // Oops: Defaut test runner timeout is 250ms | |
| buster.testCase("Async stuff", { | |
| "does things asynchonously": function (done) { | |
| setTimeout(function () { | |
| assert(true); | |
| done(); | |
| }, 100); | |
| }, |
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
| // Plugin | |
| module.exports = { | |
| configure: function (config) { | |
| config.on("load:sources", function (sources) {}); | |
| config.on("load:resources", function (resourceSet, rootPath) {}); | |
| }, | |
| run: function (testRunner) {}, | |
| // ... |
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
| module.exports = { | |
| configure: function(conf) { | |
| var testsToLoad = []; | |
| conf.options.autoRun = false; | |
| conf.on("load:tests", function(tests, root) { | |
| while(tests.length > 0) {testsToLoad.unshift(tests.pop())} | |
| }); | |
| conf.on("load:resources", function(rs) { | |
| var testsStr = testsToLoad.map(function (t) { return "'" + t + "'"; }).join(", "); | |
| var res = rs.addResource("/_buster-load-all.js", { |
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
| // Original | |
| it("fetches a resource", function() { | |
| this.jQueryGet = this.sandbox.stub(jQuery, "get"), | |
| this.response = null | |
| this.jQueryGet.callsArgWith(1, "OK") | |
| this.object.fetch("/foo", function(r) { this.response = r }, this) | |
| waitsFor(function() { return this.response }) | |
| runs(function() { |
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
| ;; Scenario: Mark word just behind point | |
| ;; Given there is no region selected | |
| ;; When I insert "This is some text" | |
| ;; And I go to point "13" | |
| ;; And I expand the region | |
| ;; Then the region should be "some" | |
| (bdd/scenario "Mark word just behind point" | |
| (bdd/insert "This is some text") | |
| (bdd/goto 13) |
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
| config.on("load:tests", function (resourceSet) { | |
| resourceSet.addProcessor(function (resource, content) { | |
| var parsed = parseScript(content); | |
| // Loop AST, extract /*:DOC */ comments, convert them | |
| // Make sure to maintain line-numbers in the output | |
| return modifiedScriptContents; | |
| }); | |
| }); |
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
| var buster = { | |
| assert: function assert(actual, message) {}, | |
| assertions: { | |
| add: function (name, options) {}, | |
| addListener: function addListener(event, listener, thisObject) {}, | |
| assert: function assert(actual, message) {}, | |
| bind: function (object, events) {}, | |
| captureException: function captureException(callback) {}, | |
| contexts: { }, | |
| create: function () {}, |
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
| var config = exports; // Vanity | |
| config["Browser tests"] = { | |
| environment: "browser", | |
| sources: ["strftime.js"], | |
| tests: ["strftime-test.js"] | |
| }; | |
| config["Server tests"] = { | |
| extends: "Browser tests", |