Skip to content

Commit

Permalink
fix(test): nut for partial success on scratch org deploy fails (#1100)
Browse files Browse the repository at this point in the history
* test: nut for partial success on scratch org deploy fails

* chore: bump core

* test: exit code is number not string
  • Loading branch information
mshanemc authored Jun 17, 2024
1 parent 8f4ef67 commit 4762f73
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 68 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"author": "Salesforce",
"bugs": "https://github.com/forcedotcom/cli/issues",
"dependencies": {
"@oclif/core": "^4.0.3",
"@salesforce/core": "^7.3.10",
"@salesforce/kit": "^3.1.1",
"@salesforce/sf-plugins-core": "^10.0.1",
"@salesforce/source-deploy-retrieve": "^11.6.5",
"@oclif/core": "^4.0.6",
"@salesforce/core": "^7.4.1",
"@salesforce/kit": "^3.1.5",
"@salesforce/sf-plugins-core": "^11.0.1",
"@salesforce/source-deploy-retrieve": "^11.6.7",
"ansis": "^3.2.0",
"change-case": "^5.4.4",
"is-wsl": "^3.1.0",
Expand Down
46 changes: 46 additions & 0 deletions test/nut/scratchCreate.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,50 @@ describe('env create scratch NUTs', () => {
expect(aliases.orgs).to.have.property(testAlias, resp.username);
});
});

describe('partial success', () => {
before(async () => {
// create settings that will fail to deploy
const scratchDefJson = parseJsonMap(
await fs.promises.readFile(path.join(session.project.dir, 'config', 'project-scratch-def.json'), 'utf8')
);
scratchDefJson.objectSettings = {
NotAnObject: {
defaultRecordType: 'bogusType',
},
};
await fs.promises.writeFile(
path.join(session.project.dir, 'config', 'project-scratch-def-1.json'),
JSON.stringify(scratchDefJson),
'utf-8'
);
});
it('creates org, auths, and sets alias even if settings deploy fails', async () => {
const alias = 'badSettingsAlias';
const result = execCmd<ScratchCreateResponse>(
`org create scratch -d -f config/project-scratch-def-1.json -a ${alias} --duration-days 1 --json`,
{
ensureExitCode: 68,
}
).jsonOutput;

// message comes from sfdx-core. if it changes, this test will need to be updated
expect(result?.message).to.include('A scratch org was created with username');
// eslint-disable-next-line no-console
console.log(result?.message);
assert(result?.data);
assert(typeof result.data === 'object');
assert('username' in result.data);
assert(typeof result.data.username === 'string');
const authFile = await readAuthFile(result.data.username);
expect(authFile).to.include.keys(['orgId', 'devHubUsername', 'accessToken']);

const aliases = await readAliases();
expect(aliases.orgs).to.have.property(alias, result.data.username);

expect(
JSON.parse(await fs.promises.readFile(path.join(session.project.dir, '.sf', 'config.json'), 'utf8'))
).to.have.property('target-org', alias);
});
});
});
2 changes: 1 addition & 1 deletion test/unit/force/org/sandboxCreate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ describe('[DEPRECATED] force:org:create (sandbox paths)', () => {
} catch (err) {
// shouldThrow doesn't necessarily throw an SfError
assert(err instanceof SfError, 'Expect error to be an instance of SfError');
expect(err.code).to.equal(68);
expect(err.exitCode).to.equal(68);
try {
// mocha really is the bin during UT
expect(err.actions).to.deep.equal([
Expand Down
102 changes: 40 additions & 62 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1678,22 +1678,22 @@
wordwrap "^1.0.0"
wrap-ansi "^7.0.0"

"@oclif/core@^4", "@oclif/core@^4.0.3":
version "4.0.3"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-4.0.3.tgz#6231272447c7057813986860448613ed38cfdc47"
integrity sha512-yM8R/M2WfSNfL9eF8clS/SbQvanvHZJgoij5bLs3ro7uAFCkL/LYcagyj0UVGbysx5AI+SNIof6OHQUXYZpOZw==
"@oclif/core@^4", "@oclif/core@^4.0.3", "@oclif/core@^4.0.6":
version "4.0.6"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-4.0.6.tgz#05958a928591567b7fe90638e0ee8df9e07eb3ff"
integrity sha512-z/4YUVQsf2pHsXRze5etbmvAYDhoUhIzpM6oJGEdsdWfvQJ6YQBogH7TdX/ItuGda6+vpfXg/4U1CtPexSF+bA==
dependencies:
ansi-escapes "^4.3.2"
ansis "^3.1.1"
clean-stack "^3.0.1"
cli-spinners "^2.9.2"
cosmiconfig "^9.0.0"
debug "^4.3.5"
ejs "^3.1.10"
get-package-type "^0.1.0"
globby "^11.1.0"
indent-string "^4.0.0"
is-wsl "^2.2.0"
lilconfig "^3.1.2"
minimatch "^9.0.4"
string-width "^4.2.3"
supports-color "^8"
Expand Down Expand Up @@ -1765,7 +1765,7 @@
strip-ansi "6.0.1"
ts-retry-promise "^0.8.1"

"@salesforce/core@^7.3.10", "@salesforce/core@^7.3.12", "@salesforce/core@^7.3.9", "@salesforce/core@^7.4.1":
"@salesforce/core@^7.3.12", "@salesforce/core@^7.4.1":
version "7.4.1"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-7.4.1.tgz#7c37623f6a89c199bf12cd6dc28d89bc950914ef"
integrity sha512-ccYs7uL4GYjdOcc44trfRnaz69kG0jU0aoT0qjPkIel8oVOyEoXaoDCG0A+2diqmicDp5uWK0pNs+tdWNj2mcQ==
Expand Down Expand Up @@ -1826,7 +1826,7 @@
typescript "^5.4.3"
wireit "^0.14.4"

"@salesforce/kit@^3.1.1", "@salesforce/kit@^3.1.2", "@salesforce/kit@^3.1.3":
"@salesforce/kit@^3.1.1", "@salesforce/kit@^3.1.2", "@salesforce/kit@^3.1.3", "@salesforce/kit@^3.1.5":
version "3.1.5"
resolved "https://registry.yarnpkg.com/@salesforce/kit/-/kit-3.1.5.tgz#ffddbf81414a4b08be00d724eef1d252ae4ba047"
integrity sha512-N7v5r7Q8VfDl6WLzl5aVrrkE7SKgZLgJPTq/65SPaLYG7f1gkUpAJp1CRQd8b/LUQc7f0su2KrCJ3BhRQC7iGA==
Expand Down Expand Up @@ -1858,7 +1858,7 @@
resolved "https://registry.yarnpkg.com/@salesforce/schemas/-/schemas-1.9.0.tgz#ba477a112653a20b4edcf989c61c57bdff9aa3ca"
integrity sha512-LiN37zG5ODT6z70sL1fxF7BQwtCX9JOWofSU8iliSNIM+WDEeinnoFtVqPInRSNt8I0RiJxIKCrqstsmQRBNvA==

"@salesforce/sf-plugins-core@^10.0.0", "@salesforce/sf-plugins-core@^10.0.1":
"@salesforce/sf-plugins-core@^10.0.0":
version "10.0.1"
resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-10.0.1.tgz#8df8e3b7a10f8ba75906c5d58eb3a7df32e42eb3"
integrity sha512-FsbZKshTgyHYO1KNuEuNGhzLj5diuh7lMElNkT4xfmwGjciDEIBtZf/aMAdN9AYpIj/TkAvi7Xnxs1gMHPOGNQ==
Expand All @@ -1876,12 +1876,30 @@
string-width "^7.1.0"
terminal-link "^3.0.0"

"@salesforce/source-deploy-retrieve@^11.6.5":
version "11.6.5"
resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-11.6.5.tgz#5a35edc42b9f0fc32384ce2515cecea6ccf3c459"
integrity sha512-JwYhLOLAkyIBsZXMt9OnDUqI8BJRu6sr5cs6EXfOD4rpIrEqpNN3+m9Gnkoe3onmTBUg4AuxFTuBT8SaBorw2g==
"@salesforce/sf-plugins-core@^11.0.1":
version "11.0.1"
resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-11.0.1.tgz#5dca567e4e18322d6341fa77e58c7debe409a7d2"
integrity sha512-A6Dzkl6XNxn6sYoZjhgnjQhwYcGek55VfWj+7zIzSjvP48YGPXy8VRiJEd4asCtYBxHBtVbrzfL23358MZ3h7Q==
dependencies:
"@inquirer/confirm" "^3.1.9"
"@inquirer/password" "^2.1.9"
"@oclif/core" "^4.0.3"
"@salesforce/core" "^7.3.12"
"@salesforce/kit" "^3.1.3"
"@salesforce/ts-types" "^2.0.9"
ansis "^3.2.0"
cli-progress "^3.12.0"
natural-orderby "^3.0.2"
slice-ansi "^7.1.0"
string-width "^7.1.0"
terminal-link "^3.0.0"

"@salesforce/source-deploy-retrieve@^11.6.7":
version "11.6.7"
resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-11.6.7.tgz#538042e31fdf92d6eeca9a45266d335e96d8af73"
integrity sha512-66KY6EfNGRom7rGDutNzLE7wr8UIPylAruLwyvShuWbXGwXKlUIQli2Vc33h6UfU15NmcrbfiaRxyCgg9oqENw==
dependencies:
"@salesforce/core" "^7.3.9"
"@salesforce/core" "^7.3.12"
"@salesforce/kit" "^3.1.1"
"@salesforce/ts-types" "^2.0.9"
fast-levenshtein "^3.0.0"
Expand Down Expand Up @@ -3929,16 +3947,6 @@ cosmiconfig@^8.0.0, cosmiconfig@^8.3.6:
parse-json "^5.2.0"
path-type "^4.0.0"

cosmiconfig@^9.0.0:
version "9.0.0"
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-9.0.0.tgz#34c3fc58287b915f3ae905ab6dc3de258b55ad9d"
integrity sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==
dependencies:
env-paths "^2.2.1"
import-fresh "^3.3.0"
js-yaml "^4.1.0"
parse-json "^5.2.0"

create-require@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
Expand Down Expand Up @@ -4252,11 +4260,6 @@ entities@^4.2.0, entities@^4.5.0:
resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48"
integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==

env-paths@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2"
integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==

error-ex@^1.3.1:
version "1.3.2"
resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"
Expand Down Expand Up @@ -5992,6 +5995,11 @@ lie@~3.3.0:
dependencies:
immediate "~3.0.5"

lilconfig@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.1.2.tgz#e4a7c3cb549e3a606c8dcc32e5ae1005e62c05cb"
integrity sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow==

lines-and-columns@^1.1.6:
version "1.2.4"
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
Expand Down Expand Up @@ -7755,16 +7763,7 @@ srcset@^5.0.0:
resolved "https://registry.yarnpkg.com/srcset/-/srcset-5.0.1.tgz#e660a728f195419e4afa95121099bc9efb7a1e36"
integrity sha512-/P1UYbGfJVlxZag7aABNRrulEXAwCSDo7fklafOQrantuPTDmYgijJMks2zusPCVzgW9+4P69mq7w6pYuZpgxw==

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -7832,14 +7831,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

[email protected], strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", [email protected], strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -8059,12 +8051,7 @@ tslib@^1.11.1:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==

tslib@^2.0.1, tslib@^2.0.3, tslib@^2.3.1, tslib@^2.5.0, tslib@^2.6.1, tslib@^2.6.2:
version "2.6.2"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==

tslib@^2.6.3:
tslib@^2.0.1, tslib@^2.0.3, tslib@^2.3.1, tslib@^2.5.0, tslib@^2.6.1, tslib@^2.6.2, tslib@^2.6.3:
version "2.6.3"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0"
integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==
Expand Down Expand Up @@ -8400,7 +8387,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343"
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -8418,15 +8405,6 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

0 comments on commit 4762f73

Please sign in to comment.