diff --git a/test/api/outputFormat.spec.js b/test/api/outputFormat.spec.js new file mode 100644 index 000000000..87505bee3 --- /dev/null +++ b/test/api/outputFormat.spec.js @@ -0,0 +1,23 @@ +/*global expect*/ +describe('outputFormat', function () { + describe('when given a format', function () { + it('decides the output that will be used for serializing errors', function () { + expect(function () { + var clonedExpect = expect.clone().outputFormat('html'); + clonedExpect(42, 'to equal', 24); + }, 'to throw', { + htmlMessage: + '
\n' + + '
expected 42 to equal 24
\n' + + '
' + }); + + expect(function () { + var clonedExpect = expect.clone().outputFormat('ansi'); + clonedExpect(42, 'to equal', 24); + }, 'to throw', { + message: '\n\x1b[31m\x1b[1mexpected\x1b[22m\x1b[39m 42 \x1b[31m\x1b[1mto equal\x1b[22m\x1b[39m 24' + }); + }); + }); +}); diff --git a/test/unexpected.spec.js b/test/unexpected.spec.js index 83d4dc37b..df49155d4 100644 --- a/test/unexpected.spec.js +++ b/test/unexpected.spec.js @@ -737,29 +737,6 @@ describe('unexpected', function () { }); }); - describe('outputFormat', function () { - describe('when given a format', function () { - it('decides the output that will be used for serializing errors', function () { - expect(function () { - var clonedExpect = expect.clone().outputFormat('html'); - clonedExpect(42, 'to equal', 24); - }, 'to throw', { - htmlMessage: - '
\n' + - '
expected 42 to equal 24
\n' + - '
' - }); - - expect(function () { - var clonedExpect = expect.clone().outputFormat('ansi'); - clonedExpect(42, 'to equal', 24); - }, 'to throw', { - message: '\n\x1b[31m\x1b[1mexpected\x1b[22m\x1b[39m 42 \x1b[31m\x1b[1mto equal\x1b[22m\x1b[39m 24' - }); - }); - }); - }); - describe('with the next assertion as a continuation', function () { describe('with "to have items satisfying" followed by another assertion', function () { it('should succeed', function () {