From c4b191dae3208cd84b657dee87bd789e3086d255 Mon Sep 17 00:00:00 2001 From: nickharris Date: Wed, 25 Mar 2020 14:15:04 -0700 Subject: [PATCH] review feedback --- .../cli-engine/config-array/ignore-pattern.js | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/tests/lib/cli-engine/config-array/ignore-pattern.js b/tests/lib/cli-engine/config-array/ignore-pattern.js index 31fb5f889d90..da1fa7814634 100644 --- a/tests/lib/cli-engine/config-array/ignore-pattern.js +++ b/tests/lib/cli-engine/config-array/ignore-pattern.js @@ -52,8 +52,13 @@ describe("IgnorePattern", () => { describe("static createIgnore(ignorePatterns)", () => { describe("with two patterns should return a function, and the function", () => { - // eslint-disable-next-line func-style - const assertions = cwd => { + + /** + * performs static createIgnre assertions against the cwd. + * @param {string} cwd cwd to be the base path for assertions + * @returns {void} + */ + function assertions(cwd) { const basePath1 = path.join(cwd, "foo/bar"); const basePath2 = path.join(cwd, "abc/"); const ignores = IgnorePattern.createIgnore([ @@ -120,11 +125,19 @@ describe("IgnorePattern", () => { it("should return true if '.dot/foo.js' and true were given.", () => { assert.strictEqual(ignores(path.join(cwd, ".dot/foo.js"), true), false); }); - }; + } assertions(process.cwd()); - // eslint-disable-next-line no-restricted-syntax - assert.doesNotThrow(() => assertions(path.parse(process.cwd()).root), "with two patterns the common ancestor is the root of the drive should not throw exception \"'newBasePath' should be an absolute path\""); + + let didThrow = false; + + try { + assertions(path.parse(process.cwd()).root); + } catch { + didThrow = true; + } + + assert.ok(!didThrow, "with two patterns the common ancestor is the root of the drive should not throw exception \"'newBasePath' should be an absolute path\""); }); }); });