From bd66568e717dd590d29a519cf517251dd853e309 Mon Sep 17 00:00:00 2001 From: Andreas Lind Date: Mon, 31 Dec 2018 21:58:06 +0100 Subject: [PATCH] eslint --fix . --- lib/convertMarkdownToMocha.js | 4 +-- lib/evaluateSnippets.js | 8 +++--- test/UnexpectedMarkdown.spec.js | 50 ++++++++++++++++----------------- test/convertMarkdownToMocha.js | 12 ++++---- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/lib/convertMarkdownToMocha.js b/lib/convertMarkdownToMocha.js index bc37517..8e60723 100644 --- a/lib/convertMarkdownToMocha.js +++ b/lib/convertMarkdownToMocha.js @@ -267,10 +267,10 @@ module.exports = function (mdSrc, fileName) { var separator = '\n//---------------------um-separator---------------------\n'; var transpiledCode = transpile(preambleSeparator + codeBlocks.map(function (codeBlock) { return codeBlock.flags.async - ? '(function unexpectedMarkdownScope() {' + + ? '(function unexpectedMarkdownScope() {' + codeBlock.code + '})("unexpectedMarkdownScope");' - : codeBlock.code; + : codeBlock.code; }).join(separator)); var transpiledBlocks = transpiledCode diff --git a/lib/evaluateSnippets.js b/lib/evaluateSnippets.js index fae9c4b..f1e6362 100644 --- a/lib/evaluateSnippets.js +++ b/lib/evaluateSnippets.js @@ -66,8 +66,8 @@ module.exports = function (snippets, options, cb) { if (exampleSnippets.length) { var codeForTranspilation = preambleSeparator + exampleSnippets.map(function (snippet) { return snippet.flags.async - ? '(function () {' + snippet.code + '})();' - : snippet.code; + ? '(function () {' + snippet.code + '})();' + : snippet.code; }).join(separator); var transpiledCode = transpile(codeForTranspilation); @@ -92,8 +92,8 @@ module.exports = function (snippets, options, cb) { if (snippet.flags.async) { var promise = vm.runInThisContext( hasBabel - ? snippet.code - : '(function () {' + snippet.code + '})();' + ? snippet.code + : '(function () {' + snippet.code + '})();' ); if (!isPromise(promise)) { throw new Error('Async code block did not return a promise or throw\n' + snippet.code); diff --git a/test/UnexpectedMarkdown.spec.js b/test/UnexpectedMarkdown.spec.js index 0231dec..d29ffc9 100644 --- a/test/UnexpectedMarkdown.spec.js +++ b/test/UnexpectedMarkdown.spec.js @@ -5,26 +5,26 @@ describe('UnexpectedMarkdown', function () { var markdown; beforeEach(function () { markdown = new UnexpectedMarkdown([ - "Asserts deep equality.", - "", - "```javascript", + 'Asserts deep equality.', + '', + '```javascript', "expect({ a: 'b' }, 'to equal', { a: 'b' });", - "var now = new Date();", + 'var now = new Date();', "expect(now, 'to equal', now);", "expect(now, 'to equal', new Date(now.getTime()));", "expect({ now: now }, 'to equal', { now: now });", - "```", - "", - "For a lot of types a failing equality test results in a nice", - "diff. Below you can see an object diff.", - "", - "```javascript", + '```', + '', + 'For a lot of types a failing equality test results in a nice', + 'diff. Below you can see an object diff.', + '', + '```javascript', "expect({ text: 'foo!' }, 'to equal', { text: 'f00!' });", - "```", - "", - "```output", - "Missing output", - "```" + '```', + '', + '```output', + 'Missing output', + '```' ].join('\n')); }); @@ -44,12 +44,12 @@ describe('UnexpectedMarkdown', function () { it('syntax highlight examples', function () { return expect(htmlPromise, 'when fulfilled', - 'to contain', 'expect'); + 'to contain', 'expect'); }); it('outputs evaluated examples', function () { return expect(htmlPromise, 'when fulfilled', - 'to contain', 'f00'); + 'to contain', 'f00'); }); }); @@ -69,16 +69,16 @@ describe('UnexpectedMarkdown', function () { it('produces a markdown where the examples has been updated', function () { return expect(updatedMarkdownPromise, 'when fulfilled', 'to contain', [ - "```output", + '```output', "expected { text: 'foo!' } to equal { text: 'f00!' }", - "", - "{", + '', + '{', " text: 'foo!' // should equal 'f00!'", - " //", - " // -foo!", - " // +f00!", - "}", - "```" + ' //', + ' // -foo!', + ' // +f00!', + '}', + '```' ].join('\n')); }); }); diff --git a/test/convertMarkdownToMocha.js b/test/convertMarkdownToMocha.js index 34a394a..2180a1d 100644 --- a/test/convertMarkdownToMocha.js +++ b/test/convertMarkdownToMocha.js @@ -27,12 +27,12 @@ var synchronousSuccessfulSnippet = var returningSuccessfulSnippet = "var blah = 'abc';\n" + "if (blah === 'abc') {\n" + - " return expect.promise(function (resolve, reject) {\n" + - " setImmediate(resolve);\n" + - " });\n" + - "} else {\n" + - " return 456;\n" + - "}\n"; + ' return expect.promise(function (resolve, reject) {\n' + + ' setImmediate(resolve);\n' + + ' });\n' + + '} else {\n' + + ' return 456;\n' + + '}\n'; var synchronousThrowingSnippet = "var bar = 'abc';\n" +