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.
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
.packageIgnorewe 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.pathwithignore.ignores()in this loop:sfdx-git-packager/src/commands/git/package.ts
Lines 194 to 206 in 272452d
and just continue if the file should be ignored.