Skip to content
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
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Apache License Version 2.0

Copyright (c) 2025 Salesforce, Inc.
Copyright (c) 2026 Salesforce, Inc.
All rights reserved.

Apache License
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"version": "3.9.5",
"author": "Salesforce",
"bugs": "https://github.com/forcedotcom/cli/issues",
"enableO11y": true,
"o11yUploadEndpoint": "https://794testsite.my.site.com/byolwr/webruntime/log/metrics",
"dependencies": {
"@salesforce/apex-node": "^8.4.2",
"@salesforce/core": "^8.24.0",
Expand Down
2 changes: 1 addition & 1 deletion src/commands/apex/get/log.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/apex/get/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/apex/list/log.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/apex/run.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/apex/run/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/apex/tail/log.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/logic/get/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/logic/run/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/flags.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/logColorize.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/reporters/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/reporters/jsonReporter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/reporters/runReporter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/reporters/testReporter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
6 changes: 3 additions & 3 deletions src/shared/TestGetBase.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -49,7 +49,7 @@ export class TestGetBase {
detailedCoverage,
concise,
jsonEnabled,
isUnifiedLogic
isUnifiedLogic,
} = options;

const testService = new TestService(connection);
Expand All @@ -64,7 +64,7 @@ export class TestGetBase {
'code-coverage': codeCoverage,
'detailed-coverage': detailedCoverage,
concise: concise ?? false,
isUnifiedLogic
isUnifiedLogic,
};

return testReporter.report(result, reportOptions);
Expand Down
2 changes: 1 addition & 1 deletion src/shared/TestRunService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion test/commands/apex/get/log.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion test/commands/apex/get/test.nut.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
10 changes: 5 additions & 5 deletions test/commands/apex/get/test.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -208,12 +208,12 @@ describe('apex:test:report', () => {

describe('isUnifiedLogic parameter', () => {
it('should NOT pass isUnifiedLogic parameter', async () => {
testReporterReportStub = sandbox.stub(TestReporter.prototype, 'report');
sandbox.stub(TestService.prototype, 'reportAsyncResults').resolves(testRunSimple);
testReporterReportStub.resolves({ success: true });
testReporterReportStub = sandbox.stub(TestReporter.prototype, 'report');
sandbox.stub(TestService.prototype, 'reportAsyncResults').resolves(testRunSimple);
testReporterReportStub.resolves({ success: true });
await Test.run(['--test-run-id', '7071w00003woTsc', '--target-org', 'test@example.com']);

expect(testReporterReportStub.calledOnce).to.be.true;
expect(testReporterReportStub.calledOnce).to.be.true;
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
expect(testReporterReportStub.getCall(0).args[1].isUnifiedLogic).to.be.undefined;
});
Expand Down
2 changes: 1 addition & 1 deletion test/commands/apex/list/log.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion test/commands/apex/loggingCommands.nut.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion test/commands/apex/run.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
10 changes: 5 additions & 5 deletions test/commands/apex/run/test.nut.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -211,8 +211,8 @@ describe('apex run test', () => {
});

it('will run specified test suites --class-names', async () => {
const result = execCmd('apex:run:test -w 10 --suite-names DreamhouseTestSuite', { ensureExitCode: 0 })
.shellOutput.stdout;
const result = execCmd('apex:run:test -w 10 --suite-names DreamhouseTestSuite', { ensureExitCode: 0 }).shellOutput
.stdout;
expect(result).to.match(/Tests Ran\s+10/);
expect(result).to.include('FileUtilitiesTest.');
expect(result).to.include('TestPropertyController.');
Expand Down Expand Up @@ -279,13 +279,13 @@ function addTestSuiteFile(projectDir: string): void {
if (!fs.existsSync(testSuitesDir)) {
fs.mkdirSync(testSuitesDir, { recursive: true });
}

const xmlContent = `<?xml version="1.0" encoding="UTF-8"?>
<ApexTestSuite xmlns="http://soap.sforce.com/2006/04/metadata">
<testClassName>FileUtilitiesTest</testClassName>
<testClassName>GeocodingServiceTest</testClassName>
<testClassName>TestPropertyController</testClassName>
</ApexTestSuite>`;
const filePath = path.join(testSuitesDir, 'DreamhouseTestSuite.testSuite-meta.xml');
const filePath = path.join(testSuitesDir, 'DreamhouseTestSuite.testSuite-meta.xml');
fs.writeFileSync(filePath, xmlContent, 'utf8');
}
52 changes: 8 additions & 44 deletions test/commands/apex/run/test.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -165,22 +165,10 @@ describe('apex:test:run', () => {
const runTestSynchronousSpy = sandbox
.stub(TestService.prototype, 'runTestAsynchronous')
.resolves(runWithCoverage);
await Test.run([
'--code-coverage',
'--result-format',
'human',
'--test-level',
'RunLocalTests',
]);
await Test.run(['--code-coverage', '--result-format', 'human', '--test-level', 'RunLocalTests']);
expect(buildPayloadSpy.calledOnce).to.be.true;
expect(runTestSynchronousSpy.calledOnce).to.be.true;
expect(buildPayloadSpy.firstCall.args).to.deep.equal([
'RunLocalTests',
undefined,
undefined,
undefined,
'Apex',
]);
expect(buildPayloadSpy.firstCall.args).to.deep.equal(['RunLocalTests', undefined, undefined, undefined, 'Apex']);
expect(runTestSynchronousSpy.firstCall.args[0]).to.deep.equal({
category: ['Apex'],
skipCodeCoverage: false,
Expand All @@ -198,13 +186,7 @@ describe('apex:test:run', () => {
await Test.run(['--class-names', 'myApex', '--test-level', 'RunSpecifiedTests']);
expect(buildPayloadSpy.calledOnce).to.be.true;
expect(runTestSynchronousSpy.calledOnce).to.be.true;
expect(buildPayloadSpy.firstCall.args).to.deep.equal([
'RunSpecifiedTests',
undefined,
'myApex',
undefined,
'',
]);
expect(buildPayloadSpy.firstCall.args).to.deep.equal(['RunSpecifiedTests', undefined, 'myApex', undefined, '']);
expect(runTestSynchronousSpy.firstCall.args[0]).to.deep.equal({
skipCodeCoverage: true,
testLevel: 'RunSpecifiedTests',
Expand Down Expand Up @@ -426,27 +408,15 @@ describe('apex:test:run', () => {
const runTestSynchronousSpy = sandbox
.stub(TestService.prototype, 'runTestAsynchronous')
.resolves(runWithCoverage);
await Test.run([
'--code-coverage',
'--result-format',
'human',
'--test-level',
'RunLocalTests',
]);
await Test.run(['--code-coverage', '--result-format', 'human', '--test-level', 'RunLocalTests']);
expect(buildPayloadSpy.calledOnce).to.be.true;
expect(runTestSynchronousSpy.calledOnce).to.be.true;
expect(buildPayloadSpy.firstCall.args).to.deep.equal([
'RunLocalTests',
undefined,
undefined,
undefined,
'Apex',
]);
expect(buildPayloadSpy.firstCall.args).to.deep.equal(['RunLocalTests', undefined, undefined, undefined, 'Apex']);
expect(runTestSynchronousSpy.firstCall.args[0]).to.deep.equal({
category: ['Apex'],
skipCodeCoverage: false,
suiteNames: undefined,
testLevel: 'RunLocalTests'
testLevel: 'RunLocalTests',
});
});

Expand All @@ -457,13 +427,7 @@ describe('apex:test:run', () => {
await Test.run(['--class-names', 'myApex', '--test-level', 'RunSpecifiedTests']);
expect(buildPayloadSpy.calledOnce).to.be.true;
expect(runTestSynchronousSpy.calledOnce).to.be.true;
expect(buildPayloadSpy.firstCall.args).to.deep.equal([
'RunSpecifiedTests',
undefined,
'myApex',
undefined,
'',
]);
expect(buildPayloadSpy.firstCall.args).to.deep.equal(['RunSpecifiedTests', undefined, 'myApex', undefined, '']);
expect(runTestSynchronousSpy.firstCall.args[0]).to.deep.equal({
skipCodeCoverage: true,
testLevel: 'RunSpecifiedTests',
Expand Down
2 changes: 1 addition & 1 deletion test/commands/apex/tail/log.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025, Salesforce, Inc.
* Copyright 2026, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading