diff --git a/.eslintrc b/.eslintrc index 674234d4..40369d2a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -3,6 +3,9 @@ "rules": { "indent": ["error", 4], "key-spacing": "error", + "quotes": ["error", "single", { + "avoidEscape": true, + }], "semi": ["error", "always"], "space-before-function-paren": ["error", { "anonymous": "always", diff --git a/test/circular-things.js b/test/circular-things.js index 98e57a38..dcab2b12 100644 --- a/test/circular-things.js +++ b/test/circular-things.js @@ -35,7 +35,7 @@ tap.test('circular test', function (assert) { ); })); - test("circular", function (t) { + test('circular', function (t) { t.plan(1); var circular = {}; circular.circular = circular; diff --git a/test/comment.js b/test/comment.js index b3f9bcc3..007d457a 100644 --- a/test/comment.js +++ b/test/comment.js @@ -130,7 +130,7 @@ tap.test('non-string types', function (assert) { t.comment(42); t.comment(6.66); t.comment({}); - t.comment({"answer": 42}); + t.comment({'answer': 42}); function ConstructorFunction() {} t.comment(new ConstructorFunction()); t.comment(ConstructorFunction); diff --git a/test/create_multiple_streams.js b/test/create_multiple_streams.js index 53f43091..8ecac498 100644 --- a/test/create_multiple_streams.js +++ b/test/create_multiple_streams.js @@ -23,7 +23,7 @@ tape.test('createMultipleStreams', function (tt) { }); th.onFinish(function () { - tt.equal(th._results.count, 2, "harness test ran"); + tt.equal(th._results.count, 2, 'harness test ran'); tt.equal(th._results.fail, 0, "harness test didn't fail"); }); }); diff --git a/test/deep-equal-failure.js b/test/deep-equal-failure.js index 6bf91d8d..e1f2659e 100644 --- a/test/deep-equal-failure.js +++ b/test/deep-equal-failure.js @@ -62,7 +62,7 @@ tap.test('deep equal failure', function (assert) { }); }); - test("deep equal", function (t) { + test('deep equal', function (t) { t.plan(1); t.equal({a: 1}, {b: 2}); }); @@ -123,7 +123,7 @@ tap.test('deep equal failure, depth 6, with option', function (assert) { }); }); - test("deep equal", {objectPrintDepth: 6}, function (t) { + test('deep equal', {objectPrintDepth: 6}, function (t) { t.plan(1); t.equal({ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }, { a: { a1: { a2: { a3: { a4: { a5: 2 } } } } } }); }); @@ -184,7 +184,7 @@ tap.test('deep equal failure, depth 6, without option', function (assert) { }); }); - test("deep equal", function (t) { + test('deep equal', function (t) { t.plan(1); t.equal({ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }, { a: { a1: { a2: { a3: { a4: { a5: 2 } } } } } }); }); diff --git a/test/end-as-callback.js b/test/end-as-callback.js index a9786881..a8c70940 100644 --- a/test/end-as-callback.js +++ b/test/end-as-callback.js @@ -1,9 +1,9 @@ -var tap = require("tap"); -var forEach = require("for-each"); -var tape = require("../"); +var tap = require('tap'); +var forEach = require('for-each'); +var tape = require('../'); var concat = require('concat-stream'); -tap.test("tape assert.end as callback", function (tt) { +tap.test('tape assert.end as callback', function (tt) { var test = tape.createHarness({ exit: false }); test.createStream().pipe(concat(function (rows) { @@ -26,27 +26,27 @@ tap.test("tape assert.end as callback", function (tt) { tt.end(); })); - test("do a task and write", function (assert) { - fakeAsyncTask("foo", function (err, value) { + test('do a task and write', function (assert) { + fakeAsyncTask('foo', function (err, value) { assert.ifError(err); - assert.equal(value, "taskfoo"); + assert.equal(value, 'taskfoo'); - fakeAsyncWrite("bar", assert.end); + fakeAsyncWrite('bar', assert.end); }); }); - test("do a task and write fail", function (assert) { - fakeAsyncTask("bar", function (err, value) { + test('do a task and write fail', function (assert) { + fakeAsyncTask('bar', function (err, value) { assert.ifError(err); - assert.equal(value, "taskbar"); + assert.equal(value, 'taskbar'); - fakeAsyncWriteFail("baz", assert.end); + fakeAsyncWriteFail('baz', assert.end); }); }); }); function fakeAsyncTask(name, cb) { - cb(null, "task" + name); + cb(null, 'task' + name); } function fakeAsyncWrite(name, cb) { @@ -54,7 +54,7 @@ function fakeAsyncWrite(name, cb) { } function fakeAsyncWriteFail(name, cb) { - cb(new Error("fail")); + cb(new Error('fail')); } /** diff --git a/test/not-deep-equal-failure.js b/test/not-deep-equal-failure.js index 166f7e02..63fbd614 100644 --- a/test/not-deep-equal-failure.js +++ b/test/not-deep-equal-failure.js @@ -62,7 +62,7 @@ tap.test('deep equal failure', function (assert) { }); }); - test("not deep equal", function (t) { + test('not deep equal', function (t) { t.plan(1); t.notDeepEqual({b: 2}, {b: 2}); }); @@ -123,7 +123,7 @@ tap.test('not deep equal failure, depth 6, with option', function (assert) { }); }); - test("not deep equal", {objectPrintDepth: 6}, function (t) { + test('not deep equal', {objectPrintDepth: 6}, function (t) { t.plan(1); t.notDeepEqual({ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }, { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }); }); @@ -184,7 +184,7 @@ tap.test('not deep equal failure, depth 6, without option', function (assert) { }); }); - test("not deep equal", function (t) { + test('not deep equal', function (t) { t.plan(1); t.notDeepEqual({ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }, { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }); }); diff --git a/test/not-equal-failure.js b/test/not-equal-failure.js index 83fc0a4e..28e31a65 100644 --- a/test/not-equal-failure.js +++ b/test/not-equal-failure.js @@ -60,7 +60,7 @@ tap.test('not equal failure', function (assert) { }); }); - test("not equal", function (t) { + test('not equal', function (t) { t.plan(1); t.notEqual(2, 2); }); diff --git a/test/onFailure.js b/test/onFailure.js index ec5d9345..666227d7 100644 --- a/test/onFailure.js +++ b/test/onFailure.js @@ -1,5 +1,5 @@ -var tap = require("tap"); -var tape = require("../").createHarness(); +var tap = require('tap'); +var tape = require('../').createHarness(); //Because this test passing depends on a failure, //we must direct the failing output of the inner test @@ -7,15 +7,15 @@ var noop = function () {}; var mockSink = {on: noop, removeListener: noop, emit: noop, end: noop}; tape.createStream().pipe(mockSink); -tap.test("on failure", { timeout: 1000 }, function (tt) { +tap.test('on failure', { timeout: 1000 }, function (tt) { tt.plan(1); - tape("dummy test", function (t) { + tape('dummy test', function (t) { t.fail(); t.end(); }); tape.onFailure(function () { - tt.pass("tape ended"); + tt.pass('tape ended'); }); }); diff --git a/test/onFinish.js b/test/onFinish.js index 80ccf051..7881273e 100644 --- a/test/onFinish.js +++ b/test/onFinish.js @@ -1,7 +1,7 @@ -var tap = require("tap"); -var tape = require("../"); +var tap = require('tap'); +var tape = require('../'); -tap.test("on finish", {timeout: 1000}, function (tt) { +tap.test('on finish', {timeout: 1000}, function (tt) { tt.plan(1); tape.onFinish(function () { tt.pass('tape ended'); diff --git a/test/only-twice.js b/test/only-twice.js index 47c97f5f..cca7c758 100644 --- a/test/only-twice.js +++ b/test/only-twice.js @@ -4,7 +4,7 @@ var tap = require('tap'); tap.test('only twice error', function (assert) { var test = tape.createHarness({ exit: false }); - test.only("first only", function (t) { + test.only('first only', function (t) { t.end(); }); diff --git a/test/only.js b/test/only.js index bcfc9058..41f2f839 100644 --- a/test/only.js +++ b/test/only.js @@ -25,21 +25,21 @@ tap.test('tape only test', function (tt) { test.createStream().pipe(concat(tc)); - test("never run fail", function (t) { + test('never run fail', function (t) { ran.push(1); t.equal(true, false); t.end(); }); - test("never run success", function (t) { + test('never run success', function (t) { ran.push(2); t.equal(true, true); t.end(); }); - test.only("run success", function (t) { + test.only('run success', function (t) { ran.push(3); - t.ok(true, "assert name"); + t.ok(true, 'assert name'); t.end(); }); }); diff --git a/test/stackTrace.js b/test/stackTrace.js index e7f8d4b7..54298184 100644 --- a/test/stackTrace.js +++ b/test/stackTrace.js @@ -17,7 +17,7 @@ tap.test('preserves stack trace with newlines', function (tt) { tt.deepEqual(data, { ok: false, id: 1, - name: "Error: Preserve stack", + name: 'Error: Preserve stack', diag: { stack: stackTrace, operator: 'error', @@ -121,7 +121,7 @@ tap.test('preserves stack trace for failed assertions', function (tt) { tt.deepEqual(data, { ok: false, id: 1, - name: "true should be false", + name: 'true should be false', diag: { at: at, stack: stack, @@ -186,7 +186,7 @@ tap.test('preserves stack trace for failed assertions where actual===falsy', fun tt.deepEqual(data, { ok: false, id: 1, - name: "false should be true", + name: 'false should be true', diag: { at: at, stack: stack, diff --git a/test/throws.js b/test/throws.js index a919b4ec..1628d822 100644 --- a/test/throws.js +++ b/test/throws.js @@ -39,7 +39,7 @@ tap.test('failures', function (tt) { + ' expected: |-\n' + ' undefined\n' + ' actual: |-\n' - + " { [TypeError: " + getNonFunctionMessage() + "] message: '" + getNonFunctionMessage() + "' }\n" + + ' { [TypeError: ' + getNonFunctionMessage() + "] message: '" + getNonFunctionMessage() + "' }\n" + ' at: Test. ($TEST/throws.js:$LINE:$COL)\n' + ' stack: |-\n' + ' TypeError: ' + getNonFunctionMessage(undefined) + '\n' @@ -53,7 +53,7 @@ tap.test('failures', function (tt) { + ' expected: |-\n' + ' undefined\n' + ' actual: |-\n' - + " { [TypeError: " + getNonFunctionMessage(null) + "] message: '" + getNonFunctionMessage(null) + "' }\n" + + ' { [TypeError: ' + getNonFunctionMessage(null) + "] message: '" + getNonFunctionMessage(null) + "' }\n" + ' at: Test. ($TEST/throws.js:$LINE:$COL)\n' + ' stack: |-\n' + ' TypeError: ' + getNonFunctionMessage(null) + '\n' @@ -67,7 +67,7 @@ tap.test('failures', function (tt) { + ' expected: |-\n' + ' undefined\n' + ' actual: |-\n' - + " { [TypeError: " + getNonFunctionMessage(true) + "] message: '" + getNonFunctionMessage(true) + "' }\n" + + ' { [TypeError: ' + getNonFunctionMessage(true) + "] message: '" + getNonFunctionMessage(true) + "' }\n" + ' at: Test. ($TEST/throws.js:$LINE:$COL)\n' + ' stack: |-\n' + ' TypeError: ' + getNonFunctionMessage(true) + '\n' @@ -81,7 +81,7 @@ tap.test('failures', function (tt) { + ' expected: |-\n' + ' undefined\n' + ' actual: |-\n' - + " { [TypeError: " + getNonFunctionMessage(false) + "] message: '" + getNonFunctionMessage(false) + "' }\n" + + ' { [TypeError: ' + getNonFunctionMessage(false) + "] message: '" + getNonFunctionMessage(false) + "' }\n" + ' at: Test. ($TEST/throws.js:$LINE:$COL)\n' + ' stack: |-\n' + ' TypeError: ' + getNonFunctionMessage(false) + '\n' @@ -95,7 +95,7 @@ tap.test('failures', function (tt) { + ' expected: |-\n' + ' undefined\n' + ' actual: |-\n' - + " { [TypeError: " + getNonFunctionMessage('abc') + "] message: '" + getNonFunctionMessage('abc') + "' }\n" + + ' { [TypeError: ' + getNonFunctionMessage('abc') + "] message: '" + getNonFunctionMessage('abc') + "' }\n" + ' at: Test. ($TEST/throws.js:$LINE:$COL)\n' + ' stack: |-\n' + ' TypeError: ' + getNonFunctionMessage('abc') + '\n' @@ -109,7 +109,7 @@ tap.test('failures', function (tt) { + ' expected: |-\n' + ' undefined\n' + ' actual: |-\n' - + " { [TypeError: " + getNonFunctionMessage(/a/g) + "] message: '" + getNonFunctionMessage(/a/g) + "' }\n" + + ' { [TypeError: ' + getNonFunctionMessage(/a/g) + "] message: '" + getNonFunctionMessage(/a/g) + "' }\n" + ' at: Test. ($TEST/throws.js:$LINE:$COL)\n' + ' stack: |-\n' + ' TypeError: ' + getNonFunctionMessage(/a/g) + '\n' @@ -123,7 +123,7 @@ tap.test('failures', function (tt) { + ' expected: |-\n' + ' undefined\n' + ' actual: |-\n' - + " { [TypeError: " + getNonFunctionMessage([]) + "] message: '" + getNonFunctionMessage([]) + "' }\n" + + ' { [TypeError: ' + getNonFunctionMessage([]) + "] message: '" + getNonFunctionMessage([]) + "' }\n" + ' at: Test. ($TEST/throws.js:$LINE:$COL)\n' + ' stack: |-\n' + ' TypeError: ' + getNonFunctionMessage([]) + '\n' @@ -137,7 +137,7 @@ tap.test('failures', function (tt) { + ' expected: |-\n' + ' undefined\n' + ' actual: |-\n' - + " { [TypeError: " + getNonFunctionMessage({}) + "] message: '" + getNonFunctionMessage({}) + "' }\n" + + ' { [TypeError: ' + getNonFunctionMessage({}) + "] message: '" + getNonFunctionMessage({}) + "' }\n" + ' at: Test. ($TEST/throws.js:$LINE:$COL)\n' + ' stack: |-\n' + ' TypeError: ' + getNonFunctionMessage({}) + '\n'