diff --git a/test/int/breakOnLoad.test.ts b/test/int/breakOnLoad.test.ts index 0940d50e..779b68a0 100644 --- a/test/int/breakOnLoad.test.ts +++ b/test/int/breakOnLoad.test.ts @@ -156,6 +156,29 @@ function runCommonTests(breakOnLoadStrategy: string) { await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bpLine, column: bpCol }); }); + + test('Hits breakpoints on the first line of two scripts', async () => { + const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_javaScript'); + const scriptPath = path.join(testProjectRoot, 'src/script.js'); + const script2Path = path.join(testProjectRoot, 'src/script2.js'); + + server = createServer({ root: testProjectRoot }); + server.listen(7890); + + const url = 'http://localhost:7890/index.html'; + + const bpLine = 1; + const bpCol = 1; + + await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bpLine, column: bpCol }); + await dc.setBreakpointsRequest({ + lines: [bpLine], + breakpoints: [{ line: bpLine, column: bpCol }], + source: { path: script2Path } + }); + await dc.continueRequest(); + await dc.assertStoppedLocation('breakpoint', { path: script2Path, line: bpLine, column: bpCol }) + }); }); } diff --git a/testdata/breakOnLoad_javaScript/index.html b/testdata/breakOnLoad_javaScript/index.html index 0ecbdb8e..618556b3 100644 --- a/testdata/breakOnLoad_javaScript/index.html +++ b/testdata/breakOnLoad_javaScript/index.html @@ -2,6 +2,7 @@ +

testdata/breakOnLoad_javaScript

diff --git a/testdata/breakOnLoad_javaScript/src/script2.js b/testdata/breakOnLoad_javaScript/src/script2.js new file mode 100644 index 00000000..049a7af7 --- /dev/null +++ b/testdata/breakOnLoad_javaScript/src/script2.js @@ -0,0 +1,7 @@ +document.write("Script2.js file"); console.log("Hi2"); +var a = 1; +var b = 1; fun2(); + +function fun2() { + return true; +} \ No newline at end of file