Skip to content

Commit

Permalink
Upgrade dev dependencies
Browse files Browse the repository at this point in the history
Required adding "return undefined" to many beforeEach clauses because of the combination of CoffeeScript's arrow functions and Mocha's new way of processing promise return values.
  • Loading branch information
domenic committed Feb 14, 2015
1 parent 7a5769e commit 2f78bd6
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 19 deletions.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
"chai": ">= 1.7.0 < 3"
},
"devDependencies": {
"chai": "~1.9.0",
"coffee-script": "~1.7.1",
"istanbul": "~0.2.6",
"ecstatic": "~0.4.13",
"glob": "~3.2.9",
"jshint": "~2.4.4",
"mocha": "~1.17.0",
"opener": "~1.3",
"q": "~1.0.0",
"underscore": "~1.6.0"
"chai": "^2.0.0",
"coffee-script": "1.9.0",
"istanbul": "0.3.5",
"ecstatic": "0.5.8",
"glob": "^4.3.5",
"jshint": "^2.6.0",
"mocha": "^1.21.5",
"opener": "^1.4.0",
"q": "^1.1.2",
"underscore": "1.7.0"
}
}
2 changes: 2 additions & 0 deletions test/assert-eventually.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe "Assert interface with eventually extender:", =>
describe "On a promise fulfilled with the number 42", =>
beforeEach =>
promise = fulfilledPromise(42)
return undefined

describe ".eventually.isNull(promise)", =>
shouldFail
Expand Down Expand Up @@ -62,6 +63,7 @@ describe "Assert interface with eventually extender:", =>
describe "On a promise fulfilled with { foo: 'bar' }", =>
beforeEach =>
promise = fulfilledPromise(foo: "bar")
return undefined

describe ".eventually.equal(promise, { foo: 'bar' })", =>
shouldFail
Expand Down
4 changes: 4 additions & 0 deletions test/assert-promise-specific.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe "Assert interface:", =>
describe "when the promise is fulfilled", =>
beforeEach =>
promise = fulfilledPromise(foo: "bar")
return undefined

describe ".isFulfilled(promise)", =>
shouldPass => assert.isFulfilled(promise)
Expand Down Expand Up @@ -49,6 +50,7 @@ describe "Assert interface:", =>
describe "when the promise is rejected", =>
beforeEach =>
promise = rejectedPromise(error)
return undefined

describe ".isFulfilled", =>
shouldFail
Expand All @@ -66,6 +68,7 @@ describe "Assert interface:", =>
describe "with an Error having message 'foo bar'", =>
beforeEach =>
promise = rejectedPromise(new Error("foo bar"))
return undefined

describe ".isRejected(promise, /bar/)", =>
shouldPass => assert.isRejected(promise, /bar/)
Expand All @@ -78,6 +81,7 @@ describe "Assert interface:", =>
describe "with a RangeError", =>
beforeEach =>
promise = rejectedPromise(new RangeError)
return undefined

describe ".isRejected(promise, RangeError)", =>
shouldPass => assert.isRejected(promise, RangeError)
Expand Down
2 changes: 1 addition & 1 deletion test/browser/libraries/q.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports.name = "Q"
exports.uri = "https://s3-us-west-1.amazonaws.com/q-releases/q.js"

exports.adapter = """
global.fulfilledPromise = Q.resolve;
global.fulfilledPromise = Q;
global.rejectedPromise = Q.reject;
global.defer = Q.defer;
"""
2 changes: 1 addition & 1 deletion test/browser/runner.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ testFilenames = glob.sync("../*.coffee", cwd: __dirname)
testScriptTags = testFilenames.map (filename) -> "<script type=\"text/coffeescript\" src=\"#{ filename }\"></script>"

htmlTemplate = fs.readFileSync(path.resolve(__dirname, "template.html")).toString()
html = _.template(htmlTemplate, { library, testScriptTags })
html = _.template(htmlTemplate)({ library, testScriptTags })

htmlPath = path.resolve(__dirname, "output.html")
fs.writeFileSync(htmlPath, html)
Expand Down
2 changes: 1 addition & 1 deletion test/browser/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<link rel="stylesheet" href="../../node_modules/mocha/mocha.css" />

<script src="http://jashkenas.github.com/coffee-script/extras/coffee-script.js"></script>
<script src="http://coffeescript.org/extras/coffee-script.js"></script>
<script src="../../node_modules/mocha/mocha.js"></script>
<script src="../../node_modules/chai/chai.js"></script>
<script src="../../lib/chai-as-promised.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions test/should-eventually.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ describe "Fulfillment value assertions:", =>
describe "On a promise fulfilled with the number 42:", =>
beforeEach =>
promise = fulfilledPromise(42)
return undefined

describe ".eventually.equal(42)", =>
shouldPass => promise.should.eventually.equal(42)
Expand Down Expand Up @@ -115,6 +116,7 @@ describe "Fulfillment value assertions:", =>
describe "On a promise fulfilled with { foo: 'bar' }:", =>
beforeEach =>
promise = fulfilledPromise(foo: "bar")
return undefined

describe ".eventually.equal({ foo: 'bar' })", =>
shouldFail
Expand Down
29 changes: 23 additions & 6 deletions test/should-promise-specific.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe "Promise-specific extensions:", =>
describe "when the promise is fulfilled", =>
beforeEach =>
promise = fulfilledPromise()
return undefined

describe ".fulfilled", =>
shouldPass => promise.should.be.fulfilled
Expand Down Expand Up @@ -76,6 +77,7 @@ describe "Promise-specific extensions:", =>
describe "when the promise is rejected", =>
beforeEach =>
promise = rejectedPromise(error)
return undefined

describe ".fulfilled", =>
shouldFail
Expand Down Expand Up @@ -104,6 +106,7 @@ describe "Promise-specific extensions:", =>
describe "with an Error having message 'foo bar'", =>
beforeEach =>
promise = rejectedPromise(new Error("foo bar"))
return undefined

describe ".rejectedWith('foo')", =>
shouldPass => promise.should.be.rejectedWith("foo")
Expand Down Expand Up @@ -136,6 +139,7 @@ describe "Promise-specific extensions:", =>
describe "with a RangeError", =>
beforeEach =>
promise = rejectedPromise(new RangeError)
return undefined

describe ".rejectedWith(RangeError)", =>
shouldPass => promise.should.be.rejectedWith(RangeError)
Expand All @@ -154,6 +158,7 @@ describe "Promise-specific extensions:", =>
describe "with a RangeError having a message 'foo bar'", =>
beforeEach =>
promise = rejectedPromise(new RangeError("foo bar"))
return undefined

describe ".rejectedWith(RangeError, 'foo')", =>
shouldPass => promise.should.be.rejectedWith(RangeError, "foo")
Expand Down Expand Up @@ -225,31 +230,43 @@ describe "Promise-specific extensions:", =>

describe ".should.notify with chaining (GH-3)", =>
describe "the original promise is fulfilled", =>
beforeEach => promise = fulfilledPromise()
beforeEach =>
promise = fulfilledPromise()
return undefined

describe "and the follow-up promise is fulfilled", =>
beforeEach => promise = promise.then(=>)
beforeEach =>
promise = promise.then(=>)
return undefined

it "should pass the test", (done) =>
promise.should.notify(done)

describe "but the follow-up promise is rejected", =>
beforeEach => promise = promise.then(=> throw error)
beforeEach =>
promise = promise.then(=> throw error)
return undefined

it "should fail the test with the error from the follow-up promise", (done) =>
promise.should.notify(assertingDoneFactory(done))

describe "the original promise is rejected", =>
beforeEach => promise = rejectedPromise(error)
beforeEach =>
promise = rejectedPromise(error)
return undefined

describe "but the follow-up promise is fulfilled", =>
beforeEach => promise = promise.then(=>)
beforeEach =>
promise = promise.then(=>)
return undefined

it "should fail the test with the error from the original promise", (done) =>
promise.should.notify(assertingDoneFactory(done))

describe "and the follow-up promise is rejected", =>
beforeEach => promise = promise.then(=> throw new Error("follow up"))
beforeEach =>
promise = promise.then(=> throw new Error("follow up"))
return undefined

it "should fail the test with the error from the original promise", (done) =>
promise.should.notify(assertingDoneFactory(done))
Expand Down

0 comments on commit 2f78bd6

Please sign in to comment.