Skip to content

Commit 8e0d97b

Browse files
committed
Add test coverage for overriding debug configuration via debug_custom.json
Some of the data from the `arduino-cli debug --info` output does not match exactly with the launch.json format required by the IDE's debugger. For this reason, some remapping of the data is required. The user can adjust the debugger configuration via a debug_custom.json file in the sketch project. The data from this file is merged into the base data provided by `arduino-cli debug --info`. It is essential that the data from debug_custom.json overrides the base data where there is overlap, yet previously there was no test coverage for this. Since the merging code gives special handling to the remapped Arduino CLI data, it is especially important to provide good coverage for overriding that data.
1 parent 7c8bfac commit 8e0d97b

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/test/suite/debug.test.ts

+26-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,27 @@ describe('debug', () => {
144144
const actual = await mergeLaunchConfig(
145145
board,
146146
programmer,
147-
{ executable },
148-
[{ configId, cwd: 'alma' }]
147+
{
148+
executable,
149+
toolchainPrefix: 'toolchain-prefix',
150+
serverPath: 'path/to/server',
151+
server: 'openocd',
152+
toolchainPath: 'path/to/toolchain',
153+
serverConfiguration: {
154+
scripts: ['path/to/config-file'],
155+
},
156+
},
157+
[
158+
{
159+
configId,
160+
cwd: 'alma',
161+
toolchainPrefix: 'custom-toolchain-prefix',
162+
serverpath: '/path/to/custom-server',
163+
servertype: 'jlink',
164+
armToolchainPath: '/path/to/custom-arm-toolchain',
165+
configFiles: ['/path/to/custom-config'],
166+
},
167+
]
149168
);
150169
assert.deepStrictEqual(actual, {
151170
configId,
@@ -154,6 +173,11 @@ describe('debug', () => {
154173
name: 'ABC (p1)',
155174
request: 'launch',
156175
type: 'cortex-debug',
176+
toolchainPrefix: 'custom-toolchain-prefix',
177+
serverpath: '/path/to/custom-server',
178+
servertype: 'jlink',
179+
armToolchainPath: '/path/to/custom-arm-toolchain',
180+
configFiles: ['/path/to/custom-config'],
157181
});
158182
});
159183

0 commit comments

Comments
 (0)