Skip to content

Commit

Permalink
fix: nut for handling forceignored files for partial bundle deletes (#…
Browse files Browse the repository at this point in the history
…716)

* fix: nut for handling forceignored files for partial bundle deletes

* chore: bump testkit

* chore: update yarn.lock

* fix: bump stl and add nuts
  • Loading branch information
shetzel authored Feb 3, 2023
1 parent 2f0ca9d commit f95be35
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 40 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"@salesforce/command": "^5.2.35",
"@salesforce/core": "^3.32.14",
"@salesforce/kit": "^1.8.3",
"@salesforce/source-deploy-retrieve": "^7.7.5",
"@salesforce/source-tracking": "^2.2.18",
"@salesforce/source-deploy-retrieve": "^7.8.0",
"@salesforce/source-tracking": "^2.2.21",
"chalk": "^4.1.2",
"got": "^11.8.3",
"jsforce": "^2.0.0-beta.19",
Expand All @@ -24,7 +24,7 @@
"devDependencies": {
"@oclif/plugin-command-snapshot": "^3.2.16",
"@oclif/plugin-help": "^5.2.2",
"@salesforce/cli-plugins-testkit": "^3.2.18",
"@salesforce/cli-plugins-testkit": "^3.2.20",
"@salesforce/dev-config": "^3.0.1",
"@salesforce/dev-scripts": "^3.1.0",
"@salesforce/plugin-command-reference": "^1.5.8",
Expand Down Expand Up @@ -168,7 +168,7 @@
"test:nuts:mdapi": "mocha \"test/nuts/mdapi.nut.ts\" --slow 3000 --timeout 1200000 --retries 0",
"test:nuts:retrieve": "cross-env PLUGIN_SOURCE_SEED_FILTER=retrieve ts-node ./test/nuts/generateNuts.ts && mocha \"test/nuts/generated/*.nut.ts\" --slow 4500 --timeout 1200000 --parallel --retries 0",
"test:nuts:retrieve:metadata": "cross-env PLUGIN_SOURCE_SEED_FILTER=retrieve.metadata ts-node ./test/nuts/generateNuts.ts && mocha \"test/nuts/generated/*.nut.ts\" --slow 4500 --timeout 1200000 --parallel --retries 0",
"test:nuts:specialTypes": "mocha \"test/nuts/territory2.nut.ts\" \"test/nuts/folderTypes.nut.ts\" \"test/nuts/translation.nut.ts\" \"test/nuts/nestedLwc.nut.ts\" --slow 4500 --timeout 1200000 --retries 0 --parallel",
"test:nuts:specialTypes": "mocha \"test/nuts/territory2.nut.ts\" \"test/nuts/folderTypes.nut.ts\" \"test/nuts/translation.nut.ts\" \"test/nuts/nestedLwc.nut.ts\" \"test/nuts/partialBundleDelete.nut.ts\" --slow 4500 --timeout 1200000 --retries 0 --parallel",
"test:nuts:specialTypes:folders": "mocha \"test/nuts/folderTypes.nut.ts\" --slow 4500 --timeout 1200000",
"test:nuts:specialTypes:nestedLwc": "mocha \"test/nuts/nestedLwc.nut.ts\" --slow 3000 --timeout 1200000 --retries 0",
"test:nuts:specialTypes:territory2": "mocha \"test/nuts/territory2.nut.ts\" --slow 4500 --timeout 1200000 --retries 0",
Expand All @@ -188,4 +188,4 @@
"publishConfig": {
"access": "public"
}
}
}
37 changes: 31 additions & 6 deletions test/nuts/partialBundleDelete.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,18 @@ describe('Partial Bundle Delete Retrieves', () => {
});
const logJsonStub = sandbox.stub(UX.prototype, 'logJson');

await oclif.run([
'force:source:retrieve',
'-m',
'DigitalExperience:site/source_plugin_nut1.sfdc_cms__view/forgotPassword',
'--json',
]);
const root = path.resolve(__dirname, '..', '..');
const config = new oclif.Config({ root });
await config.load();
await oclif.run(
[
'force:source:retrieve',
'-m',
'DigitalExperience:site/source_plugin_nut1.sfdc_cms__view/forgotPassword',
'--json',
],
config
);

expect(fs.existsSync(forgotPasswordTranslationFile)).to.be.false;
expect(logJsonStub.args[0][0]).to.deep.equal(getExpectedCmdJSON(projectPath));
Expand Down Expand Up @@ -189,6 +195,25 @@ describe('Partial Bundle Delete Retrieves', () => {
filePath: testCssFile,
});
});

// This test uses the dreamhouse-lwc repo and retrieves an LWC that has local
// jest tests in the __tests__ directory.
it('should not replace forceignored files in a local LWC', () => {
const brokerCardPath = path.join(lwcSrcDir, 'brokerCard');

// This dir should NOT be deleted after a retrieve of the component from the org.
const testsDir = path.join(brokerCardPath, '__tests__');
expect(fs.existsSync(testsDir)).to.be.true;

const result = execCmd<RetrieveCommandResult>(
`force:source:retrieve -p ${brokerCardPath} -u ${scratchOrgUsername} --json`,
{ ensureExitCode: 0 }
);

expect(fs.existsSync(testsDir)).to.be.true;
const inboundFiles = result.jsonOutput?.result?.inboundFiles;
expect(inboundFiles).to.be.an('array').and.not.empty;
});
});
});

Expand Down
51 changes: 22 additions & 29 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@
is-wsl "^2.1.1"
tslib "^2.3.1"

"@oclif/core@^1.12.0", "@oclif/core@^1.20.3", "@oclif/core@^1.20.4", "@oclif/core@^1.21.0", "@oclif/core@^1.22.0", "@oclif/core@^1.23.0", "@oclif/core@^1.23.1", "@oclif/core@^1.9.9":
"@oclif/core@^1.12.0", "@oclif/core@^1.20.3", "@oclif/core@^1.20.4", "@oclif/core@^1.22.0", "@oclif/core@^1.23.0", "@oclif/core@^1.23.1", "@oclif/core@^1.9.9":
version "1.24.0"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-1.24.0.tgz#e94e2f3a1259ebb3cc867d04b12c5bfc31c21f50"
integrity sha512-J41suyV4fLfLcRRySZdtgFYSjIlpYqD90SY01Fm4+ZJUMcfDh/eQAD4sogyYOsIT0bfEzYOyYCjmfHmgcoX5aA==
Expand Down Expand Up @@ -911,14 +911,7 @@
widest-line "^3.1.0"
wrap-ansi "^6.2.0"

"@oclif/plugin-help@^5.1.19":
version "5.1.20"
resolved "https://registry.yarnpkg.com/@oclif/plugin-help/-/plugin-help-5.1.20.tgz#eba25a93266c271c7bbd08034bf53975f022476e"
integrity sha512-N8xRxE/isFcdBDI8cobixEZA5toxIK5jbxpwALNTr4s8KNAtBA3ORQrSiY0fWGkcv0sCGMwZw7rJ0Izh18JPsw==
dependencies:
"@oclif/core" "^1.21.0"

"@oclif/plugin-help@^5.2.2":
"@oclif/plugin-help@^5.1.19", "@oclif/plugin-help@^5.2.2":
version "5.2.2"
resolved "https://registry.yarnpkg.com/@oclif/plugin-help/-/plugin-help-5.2.2.tgz#f00e60b1349c4ec62c1d6a98d3a424899373c5ad"
integrity sha512-ok8gS2phqA4MiGkjCrZPFvhNIHIp35WsvNNVUn4GL8WZYQ5mk1cZuu+IIqTZxBFZ4QDUZLVkumrhsqx3oNId9A==
Expand Down Expand Up @@ -1094,12 +1087,12 @@
mv "~2"
safe-json-stringify "~1"

"@salesforce/cli-plugins-testkit@^3.2.15", "@salesforce/cli-plugins-testkit@^3.2.18":
version "3.2.18"
resolved "https://registry.yarnpkg.com/@salesforce/cli-plugins-testkit/-/cli-plugins-testkit-3.2.18.tgz#6c2857cef50a0035205a4150c6d609f36e3b0fae"
integrity sha512-tfm1lYPYcOsx9+ELUx+b9ZbAD5mOIhtvGjqpG3/NG1jeghLNPjbDDX6bL1ottw/+mYBVymIrj1krhKxOUpqJCw==
"@salesforce/cli-plugins-testkit@^3.2.15", "@salesforce/cli-plugins-testkit@^3.2.20":
version "3.2.20"
resolved "https://registry.yarnpkg.com/@salesforce/cli-plugins-testkit/-/cli-plugins-testkit-3.2.20.tgz#15f0e3a50e2242c482bb89fb18464473f8cc2cbc"
integrity sha512-EOKTZQrTiyZWPUKwbjZTJf9UvLlUrnXGN2qDgi65S7OH4W/bR1syRlrVDJ8w/F5mSqKaExhGGoFviycRrWrW8g==
dependencies:
"@salesforce/core" "^3.32.12"
"@salesforce/core" "^3.33.1"
"@salesforce/kit" "^1.8.0"
"@salesforce/ts-types" "^1.7.2"
"@types/shelljs" "^0.8.11"
Expand All @@ -1121,10 +1114,10 @@
"@salesforce/ts-types" "^1.7.1"
chalk "^2.4.2"

"@salesforce/core@^3.23.9", "@salesforce/core@^3.24.0", "@salesforce/core@^3.25.1", "@salesforce/core@^3.31.19", "@salesforce/core@^3.32.11", "@salesforce/core@^3.32.12", "@salesforce/core@^3.32.13", "@salesforce/core@^3.32.14":
version "3.32.14"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-3.32.14.tgz#8746656d72776f27bc2cbfba7344d4f7ddd236ca"
integrity sha512-2hpjdYgVFdi9Bgihw8skElhbCi3U0uowrsoCNljtCHrxnm+ORyqwsdDAnNemKUPBL9JGX4ASfWcD4m7F8m9Ysw==
"@salesforce/core@^3.23.9", "@salesforce/core@^3.24.0", "@salesforce/core@^3.25.1", "@salesforce/core@^3.31.19", "@salesforce/core@^3.32.11", "@salesforce/core@^3.32.12", "@salesforce/core@^3.32.13", "@salesforce/core@^3.32.14", "@salesforce/core@^3.33.1":
version "3.33.1"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-3.33.1.tgz#3dd0a44ba22763e8e0c2c97df03393e5c2c845d9"
integrity sha512-jaed8rK+NhSxB6MjYUN8f/2VkvtbFN/Ce/l6JvgFE+cvOf2g+lPv1pSsnKKlaSiiYcXkOvIRDT9d9ns1RLJzUw==
dependencies:
"@salesforce/bunyan" "^2.0.0"
"@salesforce/kit" "^1.8.0"
Expand Down Expand Up @@ -1286,13 +1279,13 @@
chalk "^4"
inquirer "^8.2.5"

"@salesforce/source-deploy-retrieve@^7.5.22", "@salesforce/source-deploy-retrieve@^7.7.3", "@salesforce/source-deploy-retrieve@^7.7.5":
version "7.7.5"
resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-7.7.5.tgz#4eb64f02d4759f98e1e64187a081c472ebe8a2ae"
integrity sha512-zkGpbvTVr2nBJfbTxShFfaa4DAOvbXiaaWjZg0oVLUDoAQh+uQKX4aPdsXqJR4pKdQR8u1JwEV7TlR1f5gMCrg==
"@salesforce/source-deploy-retrieve@^7.5.22", "@salesforce/source-deploy-retrieve@^7.8.0":
version "7.8.0"
resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-7.8.0.tgz#fc0195a049282509f9687e49bf0d623e1c5fe89a"
integrity sha512-DpUK4QW8Ee5Mrjv1+43+gLhlFm9GgvMbQ4dRW3IkwMiGwhTIxZ/kyV3gqWK6/YI81P2EY46B3suV6QBnbk97gg==
dependencies:
"@salesforce/core" "^3.32.13"
"@salesforce/kit" "^1.8.0"
"@salesforce/kit" "^1.8.3"
"@salesforce/ts-types" "^1.7.2"
archiver "^5.3.1"
fast-xml-parser "^3.21.1"
Expand Down Expand Up @@ -1322,14 +1315,14 @@
sinon "^10.0.0"
strip-ansi "^7.0.1"

"@salesforce/source-tracking@^2.2.18":
version "2.2.18"
resolved "https://registry.yarnpkg.com/@salesforce/source-tracking/-/source-tracking-2.2.18.tgz#f58c1da69d802de36eee000b09772b04f2cbb0ad"
integrity sha512-xxzudKTaHTrYoOclL+PwOsTHFK8rWB952SFcAW+DmrilddKlq39Qu9SbffKTNFKPpKt9YuX7x+d3sbVQReFCpg==
"@salesforce/source-tracking@^2.2.21":
version "2.2.21"
resolved "https://registry.yarnpkg.com/@salesforce/source-tracking/-/source-tracking-2.2.21.tgz#de1559ac6bf7081c54c392cd51b0e6db6f29414d"
integrity sha512-el2mEsEV+CMGTq0g7cp+23wnRLzivYiIp3QtIOgVThZkHmwueuaNFlP0swWcoX/g5GKo+LuVf6VpUnrmq+nJNg==
dependencies:
"@salesforce/core" "^3.32.12"
"@salesforce/core" "^3.33.1"
"@salesforce/kit" "^1.8.3"
"@salesforce/source-deploy-retrieve" "^7.7.3"
"@salesforce/source-deploy-retrieve" "^7.8.0"
graceful-fs "^4.2.10"
isomorphic-git "1.17.0"
ts-retry-promise "^0.7.0"
Expand Down

0 comments on commit f95be35

Please sign in to comment.