Skip to content
This repository was archived by the owner on Jul 8, 2023. It is now read-only.

Commit 154b28a

Browse files
committed
Make CoffeeScript optional, improved coverage.
1 parent 220cd6a commit 154b28a

File tree

6 files changed

+30
-27
lines changed

6 files changed

+30
-27
lines changed

lib/CouchBuilder.js

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/handler/CommonCoffeeHandler.js

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,21 @@
3232
"node": ">= 0.10.0",
3333
"npm": ">= 1.0.0"
3434
},
35-
"devDependencies": {
36-
"chai": "^3.0.0",
37-
"codecov.io": "^0.1.4",
38-
"coffee-coverage": "^1.0.1",
39-
"coffee-script": "^1.9.2",
40-
"coffeelint": "^1.10.1",
41-
"istanbul": "^0.4.0",
42-
"mocha": "^2.2.5",
43-
"sinon": "^1.14.1"
44-
},
4535
"dependencies": {
4636
"bluebird": "^3.1.5",
4737
"readdirp": "^2.0.0"
38+
},
39+
"optionalDependencies": {
40+
"coffee-script": "^1.10.0"
41+
},
42+
"devDependencies": {
43+
"chai": "^3.5.0",
44+
"codecov.io": "^0.1.6",
45+
"coffee-coverage": "^1.0.1",
46+
"coffee-script": "^1.10.0",
47+
"coffeelint": "^1.14.2",
48+
"istanbul": "^0.4.2",
49+
"mocha": "^2.4.5",
50+
"sinon": "^1.17.3"
4851
}
4952
}

src/CouchBuilder.coffee

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ module.exports = class CouchBuilder
3636

3737
_processEntries: (entries) -> new Promise (resolve, reject) =>
3838
entries.sort (left, right) ->
39-
return -1 if left.path < right.path
40-
return 1 if left.path > right.path
41-
42-
### !pragma coverage-skip-next ###
43-
return 0 # should never get two identical paths
39+
return if left.path < right.path then -1 else 1
4440

4541
Promise.all(@_processPath entry.fullPath for entry in entries)
4642
.then (results) =>

src/handler/CommonCoffeeHandler.coffee

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
coffee = require 'coffee-script'
21
fs = require 'fs'
32
path = require 'path'
43
Promise = require 'bluebird'
@@ -27,6 +26,8 @@ module.exports = class CommonCoffeeHandler
2726

2827
return reject error
2928

29+
coffee = require 'coffee-script'
30+
3031
try
3132
js = coffee.compile data.toString()
3233
catch error

test/suite/handler/error/HandlerError.spec.coffee

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,22 @@ HandlerError = require '../../../../src/handler/error/HandlerError'
22

33
describe 'HandlerError', ->
44

5-
beforeEach ->
5+
it 'stores the supplied error details', ->
66
@cause = new Error 'Message.'
77
@subject = new HandlerError 'HandlerName', '/path/to/file', @cause
88

9-
it 'stores the supplied error details', ->
109
assert.strictEqual @subject.message, "HandlerName could not process '/path/to/file'."
1110
assert.strictEqual @subject.toString(),
1211
"HandlerName could not process '/path/to/file'. Caused by:\n\nError: Message."
1312
assert.strictEqual @subject.handlerName, 'HandlerName'
1413
assert.strictEqual @subject.filename, '/path/to/file'
1514
assert.strictEqual @subject.cause, @cause
15+
16+
it 'handles errors with no cause', ->
17+
@subject = new HandlerError 'HandlerName', '/path/to/file'
18+
19+
assert.strictEqual @subject.message, "HandlerName could not process '/path/to/file'."
20+
assert.strictEqual @subject.toString(), "HandlerName could not process '/path/to/file'."
21+
assert.strictEqual @subject.handlerName, 'HandlerName'
22+
assert.strictEqual @subject.filename, '/path/to/file'
23+
assert.isUndefined @subject.cause

0 commit comments

Comments
 (0)