From 635e1a0274e89dfaa76e3704f102d3c70feaa037 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 28 Jul 2021 20:56:11 -0700 Subject: [PATCH] test: add test-debugger-breakpoint-exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds test coverage to `unpackError()` in `lib/internal/debugger/inspect_client.js`. That function previously was untested. PR-URL: https://github.com/nodejs/node/pull/39570 Refs: https://github.com/nodejs/node-inspect/issues/101 Reviewed-By: Jan Krems Reviewed-By: Michaƫl Zasso --- .../test-debugger-breakpoint-exists.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/sequential/test-debugger-breakpoint-exists.js diff --git a/test/sequential/test-debugger-breakpoint-exists.js b/test/sequential/test-debugger-breakpoint-exists.js new file mode 100644 index 00000000000000..7be0ba657fa981 --- /dev/null +++ b/test/sequential/test-debugger-breakpoint-exists.js @@ -0,0 +1,27 @@ +'use strict'; + +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/debugger'); + +// Test for "Breakpoint at specified location already exists" error. +{ + const script = fixtures.path('debugger', 'three-lines.js'); + const cli = startCLI([script]); + + function onFatal(error) { + cli.quit(); + throw error; + } + + cli.waitForInitialBreak() + .then(() => cli.waitForPrompt()) + .then(() => cli.command('setBreakpoint(1)')) + .then(() => cli.command('setBreakpoint(1)')) + .then(() => cli.waitFor(/Breakpoint at specified location already exists/)) + .then(() => cli.quit()) + .then(null, onFatal); +}