diff --git a/.eslintrc b/.eslintrc index 5e638d63..8e2f1479 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,12 @@ { "root": true, + "env": { + "browser": true, + "node": true, + }, + "globals": { + "Promise": false, + }, "rules": { "indent": ["error", 4], "key-spacing": "error", @@ -8,6 +15,7 @@ "anonymous": "always", "named": "never", }], + "no-undef": "error", }, "overrides": [ { @@ -16,5 +24,11 @@ "ecmaVersion": 2017, }, }, + { + "files": ["example/**", "test/**"], + "globals": { + "g": false, + }, + }, ], } diff --git a/test/promise_fail.js b/test/promise_fail.js index f7148cc1..3fa8892a 100644 --- a/test/promise_fail.js +++ b/test/promise_fail.js @@ -17,7 +17,7 @@ tap.test('callback returning rejected promise should cause that test (and only t return tt.pass('the test file indicated it should be skipped'); } - strippedString = stripFullStack(rowsString); + var strippedString = stripFullStack(rowsString); // hack for consistency across all versions of node // some versions produce a longer stack trace for some reason @@ -60,7 +60,7 @@ tap.test('subtest callback returning rejected promise should cause that subtest return tt.pass('the test file indicated it should be skipped'); } - strippedString = stripFullStack(rowsString); + var strippedString = stripFullStack(rowsString); // hack for consistency across all versions of node // some versions produce a longer stack trace for some reason diff --git a/test/stackTrace.js b/test/stackTrace.js index 681ce288..c5296600 100644 --- a/test/stackTrace.js +++ b/test/stackTrace.js @@ -107,7 +107,7 @@ tap.test('preserves stack trace for failed assertions', function (tt) { parser.once('assert', function (data) { tt.equal(typeof data.diag.at, 'string'); tt.equal(typeof data.diag.stack, 'string'); - at = data.diag.at || ''; + var at = data.diag.at || ''; stack = data.diag.stack || ''; tt.ok(/^Error: true should be false(\n at .+)+/.exec(stack), 'stack should be a stack'); tt.deepEqual(data, { @@ -172,7 +172,7 @@ tap.test('preserves stack trace for failed assertions where actual===falsy', fun parser.once('assert', function (data) { tt.equal(typeof data.diag.at, 'string'); tt.equal(typeof data.diag.stack, 'string'); - at = data.diag.at || ''; + var at = data.diag.at || ''; stack = data.diag.stack || ''; tt.ok(/^Error: false should be true(\n at .+)+/.exec(stack), 'stack should be a stack'); tt.deepEqual(data, {