From ca1b5f78055047fbed8e76c0a254cf2ad95279ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Colladon?= Date: Wed, 17 May 2023 17:17:28 +0200 Subject: [PATCH 1/4] fix: return result to output it with `--json` --- src/commands/sgd/source/delta.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/sgd/source/delta.ts b/src/commands/sgd/source/delta.ts index 0bd2bd74..5ecd5374 100644 --- a/src/commands/sgd/source/delta.ts +++ b/src/commands/sgd/source/delta.ts @@ -105,6 +105,6 @@ export default class SourceDeltaGenerate extends SfdxCommand { process.exitCode = 1 } this.ux.log(JSON.stringify(output, null, 2)) - return null + return output } } From ec5bc800b8d3fe2656bdb32787641e9099ad32a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Colladon?= Date: Wed, 17 May 2023 17:17:55 +0200 Subject: [PATCH 2/4] test: add NUT tests for `--json` success|error use cases --- __tests__/functional/delta.nut.ts | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/__tests__/functional/delta.nut.ts b/__tests__/functional/delta.nut.ts index 269ef136..c258310f 100644 --- a/__tests__/functional/delta.nut.ts +++ b/__tests__/functional/delta.nut.ts @@ -9,4 +9,36 @@ describe('sgd:source:delta NUTS', () => { }).shellOutput expect(result).to.include('sgd:source:delta') }) + + it('detects not existing output folder', () => { + const result = execCmd('sgd:source:delta --from "HEAD"', { + ensureExitCode: 1, + }).shellOutput + expect(result).to.include('folder does not exist') + expect(result).to.include('"success": false') + }) + + it('detects not existing output folder with json outputs', () => { + const result = execCmd('sgd:source:delta --from "HEAD" --json', { + ensureExitCode: 1, + }).shellOutput + expect(result).to.include('folder does not exist') + expect(result).to.include('"success": false') + }) + + it('outputs json', () => { + const result = execCmd('sgd:source:delta --from "HEAD" -o reports', { + ensureExitCode: 0, + }).shellOutput + expect(result).to.include('"error": null') + expect(result).to.include('"success": true') + }) + + it('outputs json with `--json`', () => { + const result = execCmd('sgd:source:delta --from "HEAD" -o reports --json', { + ensureExitCode: 0, + }).shellOutput + expect(result).to.include('"error": null') + expect(result).to.include('"success": true') + }) }) From e212adb30d737ef691d81a53dc3807c23ede35b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Colladon?= Date: Wed, 17 May 2023 17:20:46 +0200 Subject: [PATCH 3/4] build: upgrade dependencies --- package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index df7b93d8..25575225 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "@swc/core": "^1.3.58", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", - "@types/node": "^20.1.5", + "@types/node": "^20.1.7", "@typescript-eslint/eslint-plugin": "^5.59.6", "@typescript-eslint/parser": "^5.59.6", "chai": "^4.3.7", diff --git a/yarn.lock b/yarn.lock index 3b37f37a..5c08ab66 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2234,10 +2234,10 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^20.1.5": - version: 20.1.5 - resolution: "@types/node@npm:20.1.5" - checksum: 0d073ed7b9cc51e2354dcf3a8ccca84d08c7d513fa8fac9462cabc164435b30f2ad296e9f2f911e6ce72da837b704f1075379be84a93bb24f76d328a2d9e8561 +"@types/node@npm:^20.1.7": + version: 20.1.7 + resolution: "@types/node@npm:20.1.7" + checksum: b722794290d22db1741e739c256876ca774b76ea2d647d9ec9d52c49b1b01049cc6f6332499a01ac81d641e8d078b33e4c5c59e409db80390ac6b8d7ef0c08a7 languageName: node linkType: hard @@ -8717,7 +8717,7 @@ __metadata: "@swc/core": ^1.3.58 "@types/chai": ^4.3.5 "@types/mocha": ^10.0.1 - "@types/node": ^20.1.5 + "@types/node": ^20.1.7 "@typescript-eslint/eslint-plugin": ^5.59.6 "@typescript-eslint/parser": ^5.59.6 chai: ^4.3.7 From cfac67904d10db551805eacfc3f6a667d03b6441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Colladon?= Date: Wed, 17 May 2023 17:26:23 +0200 Subject: [PATCH 4/4] ci: improve PR template --- .github/PULL_REQUEST_TEMPLATE.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index af4a43ef..466cf95b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -22,6 +22,7 @@ Thanks for sending a pull request! Please make sure to have a look to the contri closes # - [ ] Jest tests added to cover the fix. +- [ ] NUT tests added to cover the fix. - [ ] E2E tests added to cover the fix. # Any particular element that can be tested locally