Skip to content

Commit

Permalink
fix: concat the useFilesToBeExempted() and autoCheckOpts.filesFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
jaig-0911 committed Nov 21, 2023
1 parent dc709d8 commit f49a730
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 2 additions & 3 deletions packages/common/src/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/*
* Copyright (c) 2021, salesforce.com, inc.
* All rights reserved.
Expand All @@ -21,8 +19,9 @@ export function log(...args: unknown[]): void {
export function useFilesToBeExempted(): string[] {
const packageName: string = process.env.SA11Y_AUTO_FILTER_LIST_PACKAGE_NAME || '';
let getFilesToBeExempted: () => string[];
if (packageName != '') {
if (packageName !== '') {
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
getFilesToBeExempted = require(packageName);
const filesToBeExempted = getFilesToBeExempted();
return filesToBeExempted;
Expand Down
5 changes: 4 additions & 1 deletion packages/jest/src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ export function setup(opts: Sa11yOpts = defaultSa11yOpts): void {
autoCheckOpts.cleanupAfterEach ||= !!process.env.SA11Y_CLEANUP;
if (process.env.SA11Y_AUTO_FILTER?.trim().length)
autoCheckOpts.filesFilter ||= process.env.SA11Y_AUTO_FILTER.split(',');
if (useFilesToBeExempted().length != 0) autoCheckOpts.filesFilter ||= useFilesToBeExempted();
if (useFilesToBeExempted().length !== 0) {
autoCheckOpts.filesFilter = autoCheckOpts.filesFilter || [];
autoCheckOpts.filesFilter = autoCheckOpts.filesFilter.concat(useFilesToBeExempted());

Check warning on line 105 in packages/jest/src/setup.ts

View check run for this annotation

Codecov / codecov/patch

packages/jest/src/setup.ts#L105

Added line #L105 was not covered by tests
}
registerSa11yAutomaticChecks(autoCheckOpts);
}

Expand Down

0 comments on commit f49a730

Please sign in to comment.