Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nickharris committed Mar 25, 2020
1 parent 0e25381 commit c4b191d
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions tests/lib/cli-engine/config-array/ignore-pattern.js
Expand Up @@ -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([
Expand Down Expand Up @@ -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\"");
});
});
});

0 comments on commit c4b191d

Please sign in to comment.