Skip to content

Commit

Permalink
Remove oversensitive error-message assertion in test
Browse files Browse the repository at this point in the history
  • Loading branch information
David Clark committed Feb 13, 2021
1 parent 1bd5ec6 commit 1834605
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Expand Up @@ -108,7 +108,7 @@ module.exports = {
'jest/valid-title': 'error',
'jest/no-test-callback': 'error',
'jest/prefer-todo': 'error',
'jest/require-to-throw-message': 'error',
'jest/require-to-throw-message': 'off',
// Many tests make assertions indirectly in a way the plugin
// does not understand.
'jest/expect-expect': 'off',
Expand Down
12 changes: 4 additions & 8 deletions test/failed-directories.test.ts
Expand Up @@ -210,18 +210,16 @@ describe('throws error for invalid JS in .config.js file', () => {
const startDir = temp.absolutePath('a/b');
const explorerOptions = { stopDir: temp.absolutePath('a') };

const expectedError = 'Unexpected token, expected ","';

test('async', async () => {
await expect(
cosmiconfig('foo', explorerOptions).search(startDir),
).rejects.toThrow(expectedError);
).rejects.toThrow();
});

test('sync', () => {
expect(() =>
cosmiconfigSync('foo', explorerOptions).search(startDir),
).toThrow(expectedError);
).toThrow();
});
});

Expand Down Expand Up @@ -296,18 +294,16 @@ describe('searching for rc files with specified extensions, throws error for inv
],
};

const expectedError = 'Unexpected token, expected ";"';

test('async', async () => {
await expect(
cosmiconfig('foo', explorerOptions).search(startDir),
).rejects.toThrow(expectedError);
).rejects.toThrow();
});

test('sync', () => {
expect(() =>
cosmiconfigSync('foo', explorerOptions).search(startDir),
).toThrow(expectedError);
).toThrow();
});
});

Expand Down

0 comments on commit 1834605

Please sign in to comment.