Skip to content

Commit 4bcf598

Browse files
committed
fix react-error-overlay linting errors
1 parent 8bf050a commit 4bcf598

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

packages/react-error-overlay/src/__tests__/extract-source-map.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ test('extracts last source map directive', async () => {
1616
});
1717

1818
test('errors when no source map', async () => {
19-
expect.assertions(1);
20-
2119
const testFileName = 'test.js';
20+
let error;
2221
try {
2322
await extractSourceMapUrl(
2423
testFileName,
2524
`console.log('hi')\n\nconsole.log('bye')`
2625
);
2726
} catch (e) {
28-
expect(e).toBe(`Cannot find a source map directive for ${testFileName}.`);
27+
error = e;
2928
}
29+
expect(error).toBe(`Cannot find a source map directive for ${testFileName}.`);
3030
});

packages/react-error-overlay/src/__tests__/get-source-map.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,14 @@ test('error on a source map with unsupported encoding', async () => {
5252
const file = fs
5353
.readFileSync(resolve(__dirname, '../../fixtures/junk-inline.mjs'))
5454
.toString('utf8');
55+
let error;
5556
try {
5657
await getSourceMap('/', file);
5758
} catch (e) {
58-
expect(e instanceof Error).toBe(true);
59-
expect(e.message).toBe(
60-
'Sorry, non-base64 inline source-map encoding is not supported.'
61-
);
59+
error = e;
6260
}
61+
expect(error instanceof Error).toBe(true);
62+
expect(error.message).toBe(
63+
'Sorry, non-base64 inline source-map encoding is not supported.'
64+
);
6365
});

packages/react-error-overlay/src/__tests__/parser/generic.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,25 @@
88
import { parse } from '../../utils/parser';
99

1010
test('throws on null', () => {
11-
expect.assertions(2);
11+
let error;
1212
try {
1313
parse(null);
1414
} catch (e) {
15-
expect(e instanceof Error).toBe(true);
16-
expect(e.message).toBe('You cannot pass a null object.');
15+
error = e;
1716
}
17+
expect(error instanceof Error).toBe(true);
18+
expect(error.message).toBe('You cannot pass a null object.');
1819
});
1920

2021
test('throws on unparsable', () => {
21-
expect.assertions(2);
22+
let error;
2223
try {
2324
parse({});
2425
} catch (e) {
25-
expect(e instanceof Error).toBe(true);
26-
expect(e.message).toBe(
27-
'The error you provided does not contain a stack trace.'
28-
);
26+
error = e;
2927
}
28+
expect(error instanceof Error).toBe(true);
29+
expect(error.message).toBe(
30+
'The error you provided does not contain a stack trace.'
31+
);
3032
});

0 commit comments

Comments
 (0)