Created
December 13, 2011 16:43
-
-
Save kwltrs/1472854 to your computer and use it in GitHub Desktop.
Sinon and JsTestDriver
This file contains 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
sinon.assert.expose(this); | |
(function() { | |
var stub; | |
TestCase("BugDemoTest", sinon.testCase({ | |
setUp: function() { | |
stub = this.stub(); | |
}, | |
"test passing": function() { | |
stub.call(); | |
sinon.assert.called(stub); // pass | |
}, | |
"test failing": function() { | |
sinon.assert.called(stub); // fail | |
}, | |
"test throwing type error": function() { | |
assertCalled(stub); // TypeError | |
} | |
})); | |
}()); |
This file contains 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
server: http://localhost:4224 | |
timeout: 100 | |
load: | |
- sinon-1.2.0.js | |
- bug_demo_test.js |
This file contains 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
$ java -jar .\JsTestDriver-1.3.3d.jar --tests all | |
.FE | |
Total 3 tests (Passed: 1; Fails: 1; Errors: 1) (2,00 ms) | |
Chrome 15.0.874.121 Windows: Run 3 tests (Passed: 1; Fails: 1; Errors 1) (2,00 ms) | |
BugDemoTest.test failing failed (1,00 ms): AssertError: expected stub to have been called at least once but was never called | |
AssertError: expected stub to have been called at least once but was never called | |
at Object.fail (http://localhost:4224/test/sinon-1.2.0.js:2838:25) | |
at failAssertion (http://localhost:4224/test/sinon-1.2.0.js:2799:20) | |
at Object.called (http://localhost:4224/test/sinon-1.2.0.js:2822:17) | |
at Object.<anonymous> (http://localhost:4224/test/bug_demo_test.js:15:26) | |
at Object.<anonymous> (http://localhost:4224/test/sinon-1.2.0.js:2687:35) | |
at Object.test failing (http://localhost:4224/test/sinon-1.2.0.js:2622:35) | |
BugDemoTest.test throwing type error error (0,00 ms): TypeError: Cannot read property 'fail' of undefined | |
TypeError: Cannot read property 'fail' of undefined | |
at failAssertion (http://localhost:4224/test/sinon-1.2.0.js:2798:32) | |
at http://localhost:4224/test/sinon-1.2.0.js:2822:17 | |
at Object.<anonymous> (http://localhost:4224/test/bug_demo_test.js:18:13) | |
at Object.<anonymous> (http://localhost:4224/test/sinon-1.2.0.js:2687:35) | |
at Object.test throwing type error (http://localhost:4224/test/sinon-1.2.0.js:2622:35) | |
Tests failed: Tests failed. See log for details. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Relates to sinonjs/sinon#66