From 3171eddd25dafb3e9a9606ac70ed6c21bb736e8e Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 19 Sep 2022 11:18:24 -0700 Subject: [PATCH] [eslint] clean up config a bit --- .eslintrc | 15 ++++-- test/stackTrace.js | 118 ++++++++++++++++++++++----------------------- 2 files changed, 67 insertions(+), 66 deletions(-) diff --git a/.eslintrc b/.eslintrc index 4d02509e..197e767f 100644 --- a/.eslintrc +++ b/.eslintrc @@ -13,8 +13,7 @@ "array-bracket-spacing": "off", "complexity": "off", "func-style": ["error", "declaration"], - "max-lines-per-function": "warn", - "max-lines": "warn", + "max-lines-per-function": "off", "max-statements-per-line": [2, { "max": 2 }], "max-statements": "warn", "multiline-comment-style": "off", @@ -22,8 +21,7 @@ "no-param-reassign": "warn", "no-underscore-dangle": "warn", "object-curly-newline": "off", - "operator-linebreak": ["error", "before"], - "sort-keys": "warn", + "sort-keys": "off", }, "ignorePatterns": [ "syntax-error.*", @@ -75,6 +73,7 @@ "no-plusplus": "warn", "no-multi-assign": "off", "no-restricted-syntax": "off", + "operator-linebreak": ["error", "before"], }, }, { @@ -126,6 +125,12 @@ "rules": { "no-use-before-define": "warn", }, - } + }, + { + "files": ["lib/test.js"], + "rules": { + "max-lines": "off", + }, + }, ], } diff --git a/test/stackTrace.js b/test/stackTrace.js index 317e2335..22ca6ce7 100644 --- a/test/stackTrace.js +++ b/test/stackTrace.js @@ -37,27 +37,27 @@ tap.test('preserves stack trace with newlines', function (tt) { stream.pipe(concat(function (body) { var strippedBody = stripAt(body.toString('utf8')); - tt.equal( - strippedBody, - 'TAP version 13\n' - + '# multiline stack trace\n' - + 'not ok 1 Error: Preserve stack\n' - + ' ---\n' - + ' operator: error\n' - + ' expected: |-\n' - + ' undefined\n' - + ' actual: |-\n' - + ' [Error: Preserve stack]\n' - + ' stack: |-\n' - + ' foo\n' - + ' bar\n' - + ' ...\n' - + '\n' - + '1..1\n' - + '# tests 1\n' - + '# pass 0\n' - + '# fail 1\n' - ); + tt.deepEqual(strippedBody.split('\n'), [].concat( + 'TAP version 13', + '# multiline stack trace', + 'not ok 1 Error: Preserve stack', + ' ---', + ' operator: error', + ' expected: |-', + ' undefined', + ' actual: |-', + ' [Error: Preserve stack]', + ' stack: |-', + ' foo', + ' bar', + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + )); tt.deepEqual(getDiag(strippedBody, true), { stack: stackTrace, @@ -201,26 +201,24 @@ tap.test('preserves stack trace for failed assertions', function (tt) { stream.pipe(concat(function (body) { var strippedBody = stripAt(body.toString('utf8')); - tt.equal( - strippedBody, - 'TAP version 13\n' - + '# t.equal stack trace\n' - + 'not ok 1 true should be false\n' - + ' ---\n' - + ' operator: equal\n' - + ' expected: false\n' - + ' actual: true\n' - + ' stack: |-\n' - + ' ' - + stack.replace(/\n/g, '\n ') - + '\n' - + ' ...\n' - + '\n' - + '1..1\n' - + '# tests 1\n' - + '# pass 0\n' - + '# fail 1\n' - ); + tt.deepEqual(strippedBody.split('\n'), [].concat( + 'TAP version 13', + '# t.equal stack trace', + 'not ok 1 true should be false', + ' ---', + ' operator: equal', + ' expected: false', + ' actual: true', + ' stack: |-', + ('\n' + stack).replace(/\n/g, '\n ').split('\n').slice(1), + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + )); tt.deepEqual(getDiag(strippedBody, true), { stack: stack, @@ -266,26 +264,24 @@ tap.test('preserves stack trace for failed assertions where actual===falsy', fun stream.pipe(concat(function (body) { var strippedBody = stripAt(body.toString('utf8')); - tt.equal( - strippedBody, - 'TAP version 13\n' - + '# t.equal stack trace\n' - + 'not ok 1 false should be true\n' - + ' ---\n' - + ' operator: equal\n' - + ' expected: true\n' - + ' actual: false\n' - + ' stack: |-\n' - + ' ' - + stack.replace(/\n/g, '\n ') - + '\n' - + ' ...\n' - + '\n' - + '1..1\n' - + '# tests 1\n' - + '# pass 0\n' - + '# fail 1\n' - ); + tt.deepEqual(strippedBody.split('\n'), [].concat( + 'TAP version 13', + '# t.equal stack trace', + 'not ok 1 false should be true', + ' ---', + ' operator: equal', + ' expected: true', + ' actual: false', + ' stack: |-', + ('\n' + stack).replace(/\n/g, '\n ').split('\n').slice(1), + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + )); tt.deepEqual(getDiag(strippedBody, true), { stack: stack,