Skip to content

Commit

Permalink
fix: handle opt-in force-ignore (directories fix)
Browse files Browse the repository at this point in the history
* fix(resolver): only forceignore real FS tree

* test: remove UT

* test: fix UT

* fix(resolver): don't forceignore dirs
  • Loading branch information
cristiand391 authored Sep 18, 2023
1 parent d9d281b commit 8c619a8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/resolve/metadataResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ export class MetadataResolver {
const components: SourceComponent[] = [];
const ignore = new Set();

if (this.forceIgnore?.denies(dir)) {
// don't apply forceignore rules against dirs
// `forceignore.denies` will pass a relative path to node-ignore, e.g.
// `path/to/force-app` -> `force-app`, note that there's no trailing slash
// so node-ignore will treat it as a file.
if (!this.tree.isDirectory(dir) && this.forceIgnore?.denies(dir)) {
return components;
}

Expand Down
5 changes: 4 additions & 1 deletion test/resolve/metadataResolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,10 @@ describe('MetadataResolver', () => {

it('should not return components if the directory is forceignored', () => {
const dirPath = xmlInFolder.COMPONENT_FOLDER_PATH;
testUtil.stubForceIgnore({ seed: dirPath, deny: [dirPath] });
testUtil.stubForceIgnore({
seed: dirPath,
deny: [join(dirPath, 'a.report-meta.xml'), join(dirPath, 'b.report-meta.xml')],
});
const access = testUtil.createMetadataResolver([
{
dirPath,
Expand Down

0 comments on commit 8c619a8

Please sign in to comment.