Skip to content

Commit

Permalink
test(cli): test --format-error
Browse files Browse the repository at this point in the history
  • Loading branch information
levithomason committed Aug 24, 2016
1 parent bb764ef commit ce2cbdc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/unit/cli.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,18 @@ describe('cli', () => {
expect(mockery.process.exit).to.have.been.calledWith(1)
})

it('should parse format-error into a function', () => {
// root export
var options = processArgs(['--format-error', '../../test/unit/fixtures/format-error-root'])
var formatErrorRoot = require('../../test/unit/fixtures/format-error-root')
expect(options.formatError).to.equal(formatErrorRoot)

// property export
options = processArgs(['--format-error', '../../test/unit/fixtures/format-error-property'])
var formatErrorProperty = require('../../test/unit/fixtures/format-error-property')
expect(options.formatError).to.equal(formatErrorProperty)
})

it('should parse browsers into an array', () => {
var options = processArgs(['--browsers', 'Chrome,ChromeCanary,Firefox'])
expect(options.browsers).to.deep.equal(['Chrome', 'ChromeCanary', 'Firefox'])
Expand Down
4 changes: 4 additions & 0 deletions test/unit/fixtures/format-error-property.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = function formatErrorProperty (msg) {
return msg
}

4 changes: 4 additions & 0 deletions test/unit/fixtures/format-error-root.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// a valid --format-error file
module.exports = function formatErrorRoot (msg) {
return msg
}

0 comments on commit ce2cbdc

Please sign in to comment.