Created
June 10, 2014 05:50
-
-
Save pchw/3fbed13bd69fb31faca6 to your computer and use it in GitHub Desktop.
use power-assert on .coffee test
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
# have to remove compilers: 'coffee:coffee-script' | |
module.exports = | |
sample: | |
options: | |
reporter: 'spec' | |
require: 'espower-coffee/guess' | |
colors: true | |
timeout: 10000 | |
src: [ | |
'test/power-assert.coffee' | |
] |
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 = (grunt) -> | |
require('time-grunt')(grunt) | |
require('load-grunt-config')(grunt) |
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
$ grunt mochaTest:sample | |
Running "mochaTest:sample" (mochaTest) task | |
array | |
#indexOf() | |
1) should return index when the value is present | |
0 passing (10ms) | |
1 failing | |
1) array #indexOf() should return index when the value is present: | |
AssertionError: # /Users/pochi/Documents/development/(snip)/test/power-assert.coffee:15 | |
assert(this.arr.indexOf(zero) === two) | |
| | | | | | |
| | | | 2 | |
| -1 0 false | |
[1,2,3] | |
[number] two | |
=> 2 | |
[number] this.arr.indexOf(zero) | |
=> -1 |
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
{ | |
"private": true, | |
"dependencies": { | |
"coffee-script": "~1.7.1", | |
"grunt-cli": "~0.1.13", | |
"grunt": "~0.4.3", | |
"grunt-mocha-test": "~0.7.0", | |
"grunt-contrib-coffee": "^0.10.1", | |
"time-grunt": "^0.3.1", | |
"load-grunt-config": "^0.8.0" | |
}, | |
"devDependencies": { | |
"mocha": "~1.14.0", | |
"should": "", | |
"sinon": "", | |
"espower-coffee": "^0.1.0" | |
} | |
} |
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
assert = require 'power-assert' | |
describe 'array', -> | |
beforeEach -> | |
@arr = [1,2,3] | |
describe '#indexOf()', -> | |
it 'should return index when the value is present', -> | |
zero = 0 | |
two = 2 | |
assert(@arr.indexOf(zero) is two) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment