Skip to content
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

chore: replay debugger to arrow functions #5299

Merged
merged 1 commit into from
Dec 29, 2023
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"prefer-arrow/prefer-arrow-functions": ["error", {}],
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/require-await": "warn",
"@typescript-eslint/no-unsafe-return": "warn"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ describe('Replay debugger adapter - integration', () => {
});
});

function createBreakpointsArgs(
const createBreakpointsArgs = (
classPath: string,
lineNumbers: number[]
): DebugProtocol.SetBreakpointsArguments {
): DebugProtocol.SetBreakpointsArguments => {
const result: DebugProtocol.SetBreakpointsArguments = {
source: {
path: classPath
Expand All @@ -271,19 +271,19 @@ function createBreakpointsArgs(
result.breakpoints!.push({ line: lineNumber })
);
return result;
}
};

function assertBreakpointsCreated(
const assertBreakpointsCreated = (
response: DebugProtocol.SetBreakpointsResponse,
expectedNumOfBreakpoints: number,
expectedSourcePath: string,
expectedLineNumbers: number[]
) {
) => {
expect(response.success).to.equal(true);
expect(response.body.breakpoints.length).to.equal(expectedNumOfBreakpoints);
response.body.breakpoints.forEach(bp => {
expect(bp.verified).to.be.true;
expect(bp.source!.path).to.equal(expectedSourcePath);
expect(expectedLineNumbers).to.include(bp.line!);
});
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ApexHeapDump } from '../../../src/core';
// Rather than duplicate a large heapdump in multiple places just have a common function return it. The
// heap dump for triggers is ends up bring pretty large but there are only 3 Account records in here.
// This method contains the elements necessary to test the Trigger variables in the heapdump.
export function createHeapDumpResultForTriggers(): ApexHeapDump {
export const createHeapDumpResultForTriggers = (): ApexHeapDump => {
// This particular heapdump was taken after an insert. The Trigger booleans for isafter and isinsert will
// be true. isbefore, isdelete, isundelete and isupdate will be false. The Trigger.new and Trigger.newmap
// will both be populated with 3 Account objects.
Expand Down Expand Up @@ -409,10 +409,10 @@ export function createHeapDumpResultForTriggers(): ApexHeapDump {
}
} as ApexExecutionOverlayResultCommandSuccess);
return heapdump;
}
};

// HeapDump with no String typename entries entries
export function createHeapDumpWithNoStringTypes(): ApexHeapDump {
export const createHeapDumpWithNoStringTypes = (): ApexHeapDump => {
const heapdump = new ApexHeapDump('some ID', 'Foo', '', 10);
heapdump.setOverlaySuccessResult({
HeapDump: {
Expand Down Expand Up @@ -602,10 +602,10 @@ export function createHeapDumpWithNoStringTypes(): ApexHeapDump {
} as ApexExecutionOverlayResultCommandSuccess);

return heapdump;
}
};

// Heapdump with typeName string entries
export function createHeapDumpWithStrings(): ApexHeapDump {
export const createHeapDumpWithStrings = (): ApexHeapDump => {
const heapdump = new ApexHeapDump('some ID', 'Foo', '', 10);
heapdump.setOverlaySuccessResult({
HeapDump: {
Expand Down Expand Up @@ -647,11 +647,11 @@ export function createHeapDumpWithStrings(): ApexHeapDump {
}
} as ApexExecutionOverlayResultCommandSuccess);
return heapdump;
}
};

// Partial heapdump with a nested reference, used to verify both leaf reference
// parsing and putting a variable together from the leaves.
export function createHeapDumpWithNestedRefs(): ApexHeapDump {
export const createHeapDumpWithNestedRefs = (): ApexHeapDump => {
const heapdump = new ApexHeapDump('some ID', 'Foo', '', 10);
heapdump.setOverlaySuccessResult({
HeapDump: {
Expand Down Expand Up @@ -835,10 +835,10 @@ export function createHeapDumpWithNestedRefs(): ApexHeapDump {
}
} as ApexExecutionOverlayResultCommandSuccess);
return heapdump;
}
};

// Partial heapdump with a circular reference
export function createHeapDumpWithCircularRefs(): ApexHeapDump {
export const createHeapDumpWithCircularRefs = (): ApexHeapDump => {
const heapdump = new ApexHeapDump('some ID', 'Foo', '', 10);
heapdump.setOverlaySuccessResult({
HeapDump: {
Expand Down Expand Up @@ -910,4 +910,4 @@ export function createHeapDumpWithCircularRefs(): ApexHeapDump {
}
} as ApexExecutionOverlayResultCommandSuccess);
return heapdump;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -662,19 +662,15 @@ describe('ApexExecutionOverlayResult heapdump parsing with ActionScript SOQL res
});

// Verify that the number passed in is a hex address
function isHex(inputString: string): boolean {
if (inputString.startsWith('0x')) {
inputString = inputString.substr(2);
}
const a = parseInt(inputString, 16);
return a.toString(16) === inputString.toLowerCase();
}
const isHex = (inputString: string): boolean => {
return /^(0x)?[a-f0-9]+$/i.test(inputString);
};

export function createExpectedXHROptions(
export const createExpectedXHROptions = (
requestBody: string | undefined,
requestUrl: string,
restHttpMethodEnum: RestHttpMethodEnum
): XHROptions {
): XHROptions => {
return {
type: restHttpMethodEnum,
url: requestUrl,
Expand All @@ -690,7 +686,7 @@ export function createExpectedXHROptions(
},
data: requestBody
} as XHROptions;
}
};

/* The test code used to generate the heap dump. This is important because of the ordering for the verification
There are comments below where the checkpoints were set and where the various SOQL/Apex ActionScript were executed
Expand Down
Loading