From 18346056c9a7fdf8d7531ea5a998edfb255fc140 Mon Sep 17 00:00:00 2001 From: David Clark Date: Sat, 13 Feb 2021 08:45:23 -0700 Subject: [PATCH] Remove oversensitive error-message assertion in test --- .eslintrc.js | 2 +- test/failed-directories.test.ts | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 796593c..01130d8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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', diff --git a/test/failed-directories.test.ts b/test/failed-directories.test.ts index 831eb30..c3080ad 100644 --- a/test/failed-directories.test.ts +++ b/test/failed-directories.test.ts @@ -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(); }); }); @@ -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(); }); });