From ce2cbdcba9bb6f40a4b29e4ff1d00d656731b4b6 Mon Sep 17 00:00:00 2001 From: Levi Thomason Date: Tue, 16 Aug 2016 11:18:18 -0700 Subject: [PATCH] test(cli): test --format-error --- test/unit/cli.spec.js | 12 ++++++++++++ test/unit/fixtures/format-error-property.js | 4 ++++ test/unit/fixtures/format-error-root.js | 4 ++++ 3 files changed, 20 insertions(+) create mode 100644 test/unit/fixtures/format-error-property.js create mode 100644 test/unit/fixtures/format-error-root.js diff --git a/test/unit/cli.spec.js b/test/unit/cli.spec.js index a4af1c659..76c387389 100644 --- a/test/unit/cli.spec.js +++ b/test/unit/cli.spec.js @@ -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']) diff --git a/test/unit/fixtures/format-error-property.js b/test/unit/fixtures/format-error-property.js new file mode 100644 index 000000000..b3c9e91e0 --- /dev/null +++ b/test/unit/fixtures/format-error-property.js @@ -0,0 +1,4 @@ +module.exports = function formatErrorProperty (msg) { + return msg +} + diff --git a/test/unit/fixtures/format-error-root.js b/test/unit/fixtures/format-error-root.js new file mode 100644 index 000000000..a17fb97e9 --- /dev/null +++ b/test/unit/fixtures/format-error-root.js @@ -0,0 +1,4 @@ +// a valid --format-error file +module.exports = function formatErrorRoot (msg) { + return msg +}