Skip to content

Commit

Permalink
Merge branch 'main' into phale/oricli-add_apex_trigger_coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
peternhale authored Dec 13, 2023
2 parents f87b475 + ea9b72b commit cd93878
Show file tree
Hide file tree
Showing 36 changed files with 1,867 additions and 1,798 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/manualRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
release:
runs-on: static-ip-ubuntu-runners
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
token: ${{ secrets.IDEE_GH_TOKEN }}
- name: Conventional Changelog Action
Expand All @@ -22,7 +22,7 @@ jobs:
# always do the release, even if there are no semantic commits
skip-on-empty: false
tag-prefix: ''
- uses: notiz-dev/github-action-json-property@2192e246737701f108a4571462b76c75e7376216
- uses: notiz-dev/github-action-json-property@7a701887f4b568b23eb7b78bb0fc49aaeb1b68d3
id: packageVersion
with:
path: 'package.json'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/slackNotify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Announce result
uses: slackapi/slack-github-action@v1.22.0
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validatePR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
format-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install modules
run: yarn
- name: Check Format
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ lerna-debug.log*
test-results.xml
xunit.xml
junit-custom.xml
path

# nyc test coverage
.nyc_output
Expand Down
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn commitlint --edit
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.13
v18.18
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"printWidth": 80,
"tabWidth": 2,
"singleQuote": true
"singleQuote": true,
"trailingComma": "none"
}
75 changes: 36 additions & 39 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,53 @@
{
"name": "@salesforce/apex-node",
"description": "Salesforce JS library for Apex",
"version": "2.1.2",
"version": "3.0.1",
"author": "Salesforce",
"bugs": "https://github.com/forcedotcom/salesforcedx-apex/issues",
"main": "lib/src/index.js",
"dependencies": {
"@salesforce/core": "^5.3.18",
"@types/istanbul-reports": "^3.0.1",
"@salesforce/core": "^6.1.0",
"@salesforce/kit": "^3.0.15",
"@types/istanbul-reports": "^3.0.4",
"faye": "1.4.0",
"glob": "^8.0.3",
"istanbul-lib-coverage": "^3.2.0",
"glob": "^10.3.10",
"istanbul-lib-coverage": "^3.2.2",
"istanbul-lib-report": "^3.0.1",
"istanbul-reports": "^3.1.6"
"istanbul-reports": "^3.1.6",
"jsforce": "^2.0.0-beta.29"
},
"devDependencies": {
"@commitlint/config-conventional": "^17.6.7",
"@salesforce/ts-sinon": "^1.4.14",
"@salesforce/ts-types": "^2.0.6",
"@types/chai": "^4.3.5",
"@commitlint/config-conventional": "^18.1.0",
"@salesforce/ts-sinon": "^1.4.19",
"@salesforce/ts-types": "^2.0.9",
"@types/chai": "^4.3.10",
"@types/glob": "^8.1.0",
"@types/istanbul-lib-coverage": "^2.0.4",
"@types/istanbul-lib-report": "^3.0.0",
"@types/mocha": "^10",
"@types/node": "^14",
"@types/sinon": "^7.5.2",
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^5.42.1",
"chai": "^4.3.7",
"commitlint": "^17.6.7",
"@types/istanbul-lib-coverage": "^2.0.6",
"@types/istanbul-lib-report": "^3.0.3",
"@types/mocha": "^10.0.4",
"@types/node": "^18",
"@types/sinon": "^17.0.1",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"chai": "^4.3.10",
"commitlint": "^18.2.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^7.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-header": "^3.0.0",
"eslint-plugin-jsdoc": "^19.1.0",
"eslint-plugin-prettier": "^3.1.4",
"husky": "^4.2.5",
"lint-staged": "^10.2.11",
"mocha": "^10",
"mocha-junit-reporter": "^1.23.3",
"nyc": "^14.1.1",
"prettier": "1.19.1",
"eslint-plugin-jsdoc": "^46.8.2",
"eslint-plugin-prettier": "^5.0.1",
"husky": "^8.0.0",
"lint-staged": "^15.0.2",
"mocha": "^10.2.0",
"mocha-junit-reporter": "^2.2.1",
"nyc": "^15.1.0",
"prettier": "^3.0.3",
"shx": "^0.3.4",
"sinon": "^7.3.1",
"sinon": "^17.0.1",
"source-map-support": "^0.5.16",
"ts-node": "^10.7.0",
"typescript": "4.6.4"
"typescript": "^5.2.2"
},
"homepage": "https://github.com/forcedotcom/salesforcedx-apex",
"keywords": [
Expand All @@ -67,13 +69,8 @@
"test": "nyc mocha ./test/**/*.test.ts",
"package": "yarn pack",
"prettier": "prettier ./**/*.{js,json,ts,md} --write",
"format:check": "prettier ./**/*.{js,json,ts,md} --debug-check"
},
"husky": {
"hooks": {
"pre-commit": "yarn lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
"format:check": "prettier ./**/*.{js,json,ts,md} --debug-check",
"prepare": "husky install"
},
"lint-staged": {
"./{src,test}/**/*.{ts,js}": [
Expand All @@ -82,7 +79,7 @@
},
"license": "BSD-3-Clause",
"engines": {
"node": ">=16.13.0"
"node": ">=18.18.2"
},
"config": {
"commitizen": {
Expand Down
2 changes: 1 addition & 1 deletion src/execute/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { soapTemplate, action, xmlCharMap } from './types';
import * as util from 'util';

function escapeXml(data: string): string {
return data.replace(/[<>&'"]/g, char => {
return data.replace(/[<>&'"]/g, (char) => {
return xmlCharMap[char];
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/localization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class Message implements LocalizationProvider {
possibleLabel = `${MISSING_LABEL_MSG} ${label}`;

if (Array.isArray(args) && args.length >= 1) {
args.forEach(arg => {
args.forEach((arg) => {
possibleLabel += ` (${arg})`;
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/logs/logService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class LogService {

if (typeof options.numberOfLogs === 'number') {
const logIdRecordList = await this.getLogRecords(options.numberOfLogs);
return logIdRecordList.map(logRecord => logRecord.Id);
return logIdRecordList.map((logRecord) => logRecord.Id);
}
return [options.logId];
}
Expand All @@ -65,7 +65,7 @@ export class LogService {
public async getLogs(options: ApexLogGetOptions): Promise<LogResult[]> {
const logIdList = await this.getLogIds(options);
const logPaths: string[] = [];
const connectionRequests = logIdList.map(async id => {
const connectionRequests = logIdList.map(async (id) => {
const url = `${this.connection.tooling._baseUrl()}/sobjects/ApexLog/${id}/Body`;
const logRecord = await this.toolingRequest(url);
if (options.outputDir) {
Expand All @@ -85,7 +85,7 @@ export class LogService {
return logMap;
}

return logs.map(log => {
return logs.map((log) => {
return { log };
});
}
Expand Down
8 changes: 4 additions & 4 deletions src/reporters/coverageReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class CoverageReporter {
coverageMap: this.coverageMap
});
const formats = this.options?.reportFormats || ['text-summary'];
formats.forEach(format => {
formats.forEach((format) => {
const report = reports.create(
format,
this.options?.reportOptions[format] || DefaultReportOptions[format]
Expand Down Expand Up @@ -142,8 +142,8 @@ export class CoverageReporter {
fileCoverageData.f = {};
fileCoverageData.b = {};
fileCoverageData.s = [
...record.Coverage.coveredLines.map(line => [line, 1]),
...record.Coverage.uncoveredLines.map(line => [line, 0])
...record.Coverage.coveredLines.map((line) => [line, 1]),
...record.Coverage.uncoveredLines.map((line) => [line, 0])
]
.map(([line, covered]) => [Number(line).toString(10), covered])
.reduce((acc, [line, value]) => {
Expand All @@ -162,7 +162,7 @@ export class CoverageReporter {
...record.Coverage.uncoveredLines
]
.sort()
.map(line => {
.map((line) => {
const statement: libCoverage.Range = {
start: {
line,
Expand Down
2 changes: 1 addition & 1 deletion src/reporters/humanReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class HumanReporter {
: elem.message;

if (elem.perClassCoverage) {
elem.perClassCoverage.forEach(perClassCov => {
elem.perClassCoverage.forEach((perClassCov) => {
testRowArray.push({
name: elem.fullName,
coveredClassName: perClassCov.apexClassOrTriggerName,
Expand Down
10 changes: 5 additions & 5 deletions src/reporters/tapReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ export class TapReporter {

let out = '';
out = out.concat(`1..${testPointCount}\n`);
results.forEach(testPoint => {
results.forEach((testPoint) => {
out = out.concat(
`${testPoint.outcome} ${testPoint.testNumber} ${testPoint.description}\n`
);
testPoint.diagnostics.forEach(s => {
testPoint.diagnostics.forEach((s) => {
out = out.concat(`# ${s}\n`);
});
});

epilog?.forEach(c => {
epilog?.forEach((c) => {
out = out.concat(`# ${c}\n`);
});
return out;
Expand Down Expand Up @@ -61,7 +61,7 @@ export class TapReporter {
if (testResult.message) {
const startsWithNewlineRegex = new RegExp(/^[/\r\n|\r|\n][\w]*/gim);
if (startsWithNewlineRegex.test(testResult.message)) {
testResult.message.split(/\r\n|\r|\n/g).forEach(msg => {
testResult.message.split(/\r\n|\r|\n/g).forEach((msg) => {
if (msg && msg.length > 0) {
message.push(msg.trim());
}
Expand All @@ -74,7 +74,7 @@ export class TapReporter {
}

if (testResult.stackTrace) {
testResult.stackTrace.split('\n').forEach(line => {
testResult.stackTrace.split('\n').forEach((line) => {
message.push(line);
});
}
Expand Down
14 changes: 7 additions & 7 deletions src/streaming/streamingClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { Client } from 'faye';
import { Connection } from '@salesforce/core';
import {
RetreiveResultsInterval,
RetrieveResultsInterval,
StreamMessage,
StreamingErrors,
TestResultMessage
Expand All @@ -35,7 +35,7 @@ export class Deferred<T> {
public promise: Promise<T>;
public resolve: Function;
constructor() {
this.promise = new Promise(resolve => (this.resolve = resolve));
this.promise = new Promise((resolve) => (this.resolve = resolve));
}
}

Expand Down Expand Up @@ -149,7 +149,7 @@ export class StreamingClient {
}

public handshake(): Promise<void> {
return new Promise(resolve => {
return new Promise((resolve) => {
this.client.handshake(() => {
resolve();
});
Expand Down Expand Up @@ -188,7 +188,7 @@ export class StreamingClient {

if (action) {
action()
.then(id => {
.then((id) => {
this.subscribedTestRunId = id;
this.subscribedTestRunIdDeferred.resolve(id);

Expand All @@ -203,10 +203,10 @@ export class StreamingClient {
queueItem: result
});
}
}, RetreiveResultsInterval);
}, RetrieveResultsInterval);
}
})
.catch(e => {
.catch((e) => {
this.disconnect();
clearInterval(intervalId);
subscriptionReject(e);
Expand All @@ -226,7 +226,7 @@ export class StreamingClient {
queueItem: result
});
}
}, RetreiveResultsInterval);
}, RetrieveResultsInterval);
}
}
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion src/streaming/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ export const enum StreamingErrors {
ERROR_UNKNOWN_CLIENT_ID = '403::Unknown client'
}

export const RetreiveResultsInterval = 60 * 1000;
export const RetrieveResultsInterval = 60 * 1000;
Loading

0 comments on commit cd93878

Please sign in to comment.