Skip to content

W-16884223 fix: set exit code based on executed command #193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ node_modules
oclif.manifest.json
oclif.lock
npm-shrinkwrap.json
.idea/
1 change: 1 addition & 0 deletions src/commands/force/lightning/lwc/test/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default class Run extends SfdxCommand {
const scriptRet = this.runJest(args);

this.ux.log(messages.getMessage('logSuccess', [scriptRet.status.toString()]));
process.exitCode=scriptRet.status;
return {
message: messages.getMessage('logSuccess', [scriptRet.status.toString()]),
jestExitCode: scriptRet.status,
Expand Down
2 changes: 1 addition & 1 deletion test/commands/lwc/test/run.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('lightning:lwc:test:run', () => {
await fs.promises.writeFile(testPath, content);

const output = execCmd<RunResult>('force:lightning:lwc:test:run', {
ensureExitCode: 0,
ensureExitCode: 1,
}).shellOutput.stderr;
expect(output).to.include('Test Suites: 1 failed');
expect(output).to.include('Tests: 1 failed');
Expand Down
6 changes: 3 additions & 3 deletions test/commands/lwc/test/setup.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ describe('lightning:lwc:test:setup', () => {
content = await fs.promises.readFile(pjsonPath, 'utf-8');
const forceignoreContent = fs.readFileSync(forceignorePath, 'utf-8');
expect(forceignoreContent).to.include('**/__tests__/**');
expect(content).to.include('"test:unit": "sfdx-lwc-jest --skipApiVersionCheck"');
expect(content).to.include('"test:unit:coverage": "sfdx-lwc-jest --coverage --skipApiVersionCheck"');
expect(content).to.include('"test:unit:debug": "sfdx-lwc-jest --debug --skipApiVersionCheck"');
expect(content).to.include('"test:unit": "sfdx-lwc-jest"');
expect(content).to.include('"test:unit:coverage": "sfdx-lwc-jest --coverage "');
expect(content).to.include('"test:unit:debug": "sfdx-lwc-jest --debug "');
expect(content).to.include('"@salesforce/sfdx-lwc-jest": "^');
});
});
Loading