Skip to content

Commit

Permalink
[eslint] clean up config a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Sep 19, 2022
1 parent 75c0c3a commit 3171edd
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 66 deletions.
15 changes: 10 additions & 5 deletions .eslintrc
Expand Up @@ -13,17 +13,15 @@
"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",
"no-negated-condition": "off",
"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.*",
Expand Down Expand Up @@ -75,6 +73,7 @@
"no-plusplus": "warn",
"no-multi-assign": "off",
"no-restricted-syntax": "off",
"operator-linebreak": ["error", "before"],
},
},
{
Expand Down Expand Up @@ -126,6 +125,12 @@
"rules": {
"no-use-before-define": "warn",
},
}
},
{
"files": ["lib/test.js"],
"rules": {
"max-lines": "off",
},
},
],
}
118 changes: 57 additions & 61 deletions test/stackTrace.js
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 3171edd

Please sign in to comment.