Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
use power-assert on .coffee test
# 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'
]
module.exports = (grunt) ->
require('time-grunt')(grunt)
require('load-grunt-config')(grunt)
$ 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
{
"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"
}
}
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