(session)
| 83 | } |
| 84 | |
| 85 | async function testBreakpoint(session) { |
| 86 | console.log('[test]', 'Setting a breakpoint and verifying it is hit'); |
| 87 | const commands = [ |
| 88 | { 'method': 'Debugger.setBreakpointByUrl', |
| 89 | 'params': { 'lineNumber': 5, |
| 90 | 'url': session.scriptURL(), |
| 91 | 'columnNumber': 0, |
| 92 | 'condition': '' } }, |
| 93 | { 'method': 'Debugger.resume' }, |
| 94 | ]; |
| 95 | await session.send(commands); |
| 96 | const { scriptSource } = await session.send({ |
| 97 | 'method': 'Debugger.getScriptSource', |
| 98 | 'params': { 'scriptId': session.mainScriptId }, |
| 99 | }); |
| 100 | assert(scriptSource && (scriptSource.includes(session.script())), |
| 101 | `Script source is wrong: ${scriptSource}`); |
| 102 | |
| 103 | await session.waitForConsoleOutput('log', ['A message', 5]); |
| 104 | const paused = await session.waitForBreakOnLine(5, session.scriptURL()); |
| 105 | const scopeId = paused.params.callFrames[0].scopeChain[0].object.objectId; |
| 106 | |
| 107 | console.log('[test]', 'Verify we can read current application state'); |
| 108 | const response = await session.send({ |
| 109 | 'method': 'Runtime.getProperties', |
| 110 | 'params': { |
| 111 | 'objectId': scopeId, |
| 112 | 'ownProperties': false, |
| 113 | 'accessorPropertiesOnly': false, |
| 114 | 'generatePreview': true |
| 115 | } |
| 116 | }); |
| 117 | assertScopeValues(response, { t: 1001, k: 1 }); |
| 118 | |
| 119 | let { result } = await session.send({ |
| 120 | 'method': 'Debugger.evaluateOnCallFrame', 'params': { |
| 121 | 'callFrameId': session.pausedDetails().callFrames[0].callFrameId, |
| 122 | 'expression': 'k + t', |
| 123 | 'objectGroup': 'console', |
| 124 | 'includeCommandLineAPI': true, |
| 125 | 'silent': false, |
| 126 | 'returnByValue': false, |
| 127 | 'generatePreview': true |
| 128 | } |
| 129 | }); |
| 130 | const expectedEvaluation = 1002; |
| 131 | assert.strictEqual( |
| 132 | result.value, |
| 133 | expectedEvaluation, |
| 134 | `Expected evaluation to be ${expectedEvaluation}, got ${result.value}.` |
| 135 | ); |
| 136 | |
| 137 | result = (await session.send({ |
| 138 | 'method': 'Runtime.evaluate', 'params': { |
| 139 | 'expression': '5 * 5' |
| 140 | } |
| 141 | })).result; |
| 142 | const expectedResult = 25; |
no test coverage detected
searching dependent graphs…