Skip to content

Resolved metadata paths does not respect .packageIgnore #56

@kristofferjansson

Description

@kristofferjansson

Hello!

We are using git-sfdc-packager to create our changesets for deploy but got an issue with lwc jest tests getting included in the package. The test setup is similar to lwc-recipes with a __tests__ folder in the lwc components.

In our .packageIgnore we have specified **/__tests__/** but the test folder and its content are still included in the package if a file in that component is changed.

The issue seems to be that the resolved metadata paths for lwc components includes all files and directories in the parent dir of the changed file and these are not checked against the ignore patterns.

One option to solve this would be to check the resolved.path with ignore.ignores() in this loop:

for (const resolved of resolvedMetadata) {
let mdPath = resolved.path;
if (isAbsolute(mdPath)) {
mdPath = relative(this.projectPath, mdPath);
}
const newPath = join(tempDir, mdPath);
await fs.mkdirp(dirname(newPath));
if (typeof resolved.source === 'string') {
await fs.writeFile(newPath, resolved.source);
} else {
await resolved.source(newPath);
}
}

and just continue if the file should be ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions