Adding tests for break on load

This commit is contained in:
Raghav Katyal 2017-11-17 14:45:04 -08:00
Родитель f4da852a9d
Коммит 9f4e20f147
22 изменённых файлов: 2789 добавлений и 2 удалений

Просмотреть файл

@ -0,0 +1,426 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import * as path from 'path';
const {createServer} = require('http-server');
import {DebugClient} from 'vscode-debugadapter-testsupport';
import * as ts from 'vscode-chrome-debug-core-testsupport';
import * as testSetup from './testSetup';
suite('BreakOnLoad', () => {
const DATA_ROOT = testSetup.DATA_ROOT;
suite('Regex Approach', () => {
let dc: ts.ExtendedDebugClient;
setup(() => {
return testSetup.setup(undefined, "regex")
.then(_dc => dc = _dc);
});
let server: any;
teardown(() => {
if (server) {
server.close();
}
return testSetup.teardown();
});
suite('TypeScript Project with SourceMaps', () => {
test('Hits a single breakpoint in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_sourceMaps');
const scriptPath = path.join(testProjectRoot, 'src/script.ts');
server = createServer({ root: testProjectRoot });
server.listen(7890);
const url = 'http://localhost:7890/index.html';
const bpLine = 3;
const bpCol = 12;
await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bpLine, column: bpCol });
});
test('Hits multiple breakpoints in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_sourceMaps');
const scriptPath = path.join(testProjectRoot, 'src/script.ts');
server = createServer({ root: testProjectRoot });
server.listen(7890);
const url = 'http://localhost:7890/index.html';
const bp1Line = 3;
const bp1Col = 12;
const bp2Line = 6;
await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bp1Line, column: bp1Col });
await dc.setBreakpointsRequest({ source: { path: scriptPath }, breakpoints: [{ line: bp2Line }] });
await dc.continueTo('breakpoint', { line: bp2Line });
});
test('Hits a breakpoint at (1,1) in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_sourceMaps');
const scriptPath = path.join(testProjectRoot, 'src/script.ts');
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 });
});
test('Hits a breakpoint in the first line in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_sourceMaps');
const scriptPath = path.join(testProjectRoot, 'src/script.ts');
server = createServer({ root: testProjectRoot });
server.listen(7890);
const url = 'http://localhost:7890/index.html';
const bpLine = 1;
const bpCol = 35;
await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bpLine, column: bpCol });
});
});
suite('Simple JavaScript Project', () => {
test('Hits a single breakpoint in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_javaScript');
const scriptPath = path.join(testProjectRoot, 'src/script.js');
server = createServer({ root: testProjectRoot });
server.listen(7890);
const url = 'http://localhost:7890/index.html';
const bpLine = 3;
const bpCol = 12;
await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bpLine, column: bpCol });
});
test('Hits multiple breakpoints in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_javaScript');
const scriptPath = path.join(testProjectRoot, 'src/script.js');
server = createServer({ root: testProjectRoot });
server.listen(7890);
const url = 'http://localhost:7890/index.html';
const bp1Line = 3;
const bp1Col = 12;
const bp2Line = 6;
await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bp1Line, column: bp1Col });
await dc.setBreakpointsRequest({ source: { path: scriptPath }, breakpoints: [{ line: bp2Line }] });
await dc.continueTo('breakpoint', { line: bp2Line });
});
test('Hits a breakpoint at (1,1) in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_javaScript');
const scriptPath = path.join(testProjectRoot, 'src/script.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 });
});
test('Hits a breakpoint in the first line in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_javaScript');
const scriptPath = path.join(testProjectRoot, 'src/script.js');
server = createServer({ root: testProjectRoot });
server.listen(7890);
const url = 'http://localhost:7890/index.html';
const bpLine = 1;
const bpCol = 35;
await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bpLine, column: bpCol });
});
});
});
suite('Instrument Approach', () => {
let dc: ts.ExtendedDebugClient;
setup(() => {
return testSetup.setup(undefined, "instrument")
.then(_dc => dc = _dc);
});
let server: any;
teardown(() => {
if (server) {
server.close();
}
return testSetup.teardown();
});
suite('TypeScript Project with SourceMaps', () => {
test('Hits a single breakpoint in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_sourceMaps');
const scriptPath = path.join(testProjectRoot, 'src/script.ts');
server = createServer({ root: testProjectRoot });
server.listen(7890);
const url = 'http://localhost:7890/index.html';
const bpLine = 3;
const bpCol = 12;
await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bpLine, column: bpCol });
});
test('Hits multiple breakpoints in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_sourceMaps');
const scriptPath = path.join(testProjectRoot, 'src/script.ts');
server = createServer({ root: testProjectRoot });
server.listen(7890);
const url = 'http://localhost:7890/index.html';
const bp1Line = 3;
const bp1Col = 12;
const bp2Line = 6;
await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bp1Line, column: bp1Col });
await dc.setBreakpointsRequest({ source: { path: scriptPath }, breakpoints: [{ line: bp2Line }] });
await dc.continueTo('breakpoint', { line: bp2Line });
});
test('Hits a breakpoint at (1,1) in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_sourceMaps');
const scriptPath = path.join(testProjectRoot, 'src/script.ts');
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 });
});
test('Hits a breakpoint in the first line in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_sourceMaps');
const scriptPath = path.join(testProjectRoot, 'src/script.ts');
server = createServer({ root: testProjectRoot });
server.listen(7890);
const url = 'http://localhost:7890/index.html';
const bpLine = 1;
const bpCol = 35;
await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bpLine, column: bpCol });
});
});
suite('Simple JavaScript Project', () => {
test('Hits a single breakpoint in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_javaScript');
const scriptPath = path.join(testProjectRoot, 'src/script.js');
server = createServer({ root: testProjectRoot });
server.listen(7890);
const url = 'http://localhost:7890/index.html';
const bpLine = 3;
const bpCol = 12;
await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bpLine, column: bpCol });
});
test('Hits multiple breakpoints in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_javaScript');
const scriptPath = path.join(testProjectRoot, 'src/script.js');
server = createServer({ root: testProjectRoot });
server.listen(7890);
const url = 'http://localhost:7890/index.html';
const bp1Line = 3;
const bp1Col = 12;
const bp2Line = 6;
await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bp1Line, column: bp1Col });
await dc.setBreakpointsRequest({ source: { path: scriptPath }, breakpoints: [{ line: bp2Line }] });
await dc.continueTo('breakpoint', { line: bp2Line });
});
test('Hits a breakpoint at (1,1) in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_javaScript');
const scriptPath = path.join(testProjectRoot, 'src/script.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 });
});
test('Hits a breakpoint in the first line in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_javaScript');
const scriptPath = path.join(testProjectRoot, 'src/script.js');
server = createServer({ root: testProjectRoot });
server.listen(7890);
const url = 'http://localhost:7890/index.html';
const bpLine = 1;
const bpCol = 35;
await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bpLine, column: bpCol });
});
});
suite('Webpack Project', () => {
test('Hits a single breakpoint in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_webpack');
const scriptPath = path.join(testProjectRoot, 'src/script.js');
server = createServer({ root: testProjectRoot });
server.listen(7890);
const url = 'http://localhost:7890/dist/index.html';
const bpLine = 3;
const bpCol = 1;
await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bpLine , column: bpCol});
});
test('Hits multiple breakpoints in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_webpack');
const scriptPath = path.join(testProjectRoot, 'src/script.js');
server = createServer({ root: testProjectRoot });
server.listen(7890);
const url = 'http://localhost:7890/dist/index.html';
// For some reason, column numbers > don't work perfectly with webpack
const bp1Line = 3;
const bp1Col = 1;
const bp2Line = 5;
const bp2Col = 1;
await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bp1Line , column: bp1Col});
await dc.setBreakpointsRequest({ source: { path: scriptPath }, breakpoints: [{ line: bp2Line , column: bp2Col}] });
await dc.continueTo('breakpoint', { line: bp2Line , column: bp2Col});
});
test('Hits a breakpoint at (1,1) in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_webpack');
const scriptPath = path.join(testProjectRoot, 'src/script.js');
server = createServer({ root: testProjectRoot });
server.listen(7890);
const url = 'http://localhost:7890/dist/index.html';
const bpLine = 1;
const bpCol = 1;
await dc.hitBreakpointUnverified({ url, webRoot: testProjectRoot }, { path: scriptPath, line: bpLine, column: bpCol });
});
});
});
suite('BreakOnLoad Disabled (strategy: none)', () => {
let dc: ts.ExtendedDebugClient;
setup(() => {
return testSetup.setup(undefined, "none")
.then(_dc => dc = _dc);
});
let server: any;
teardown(() => {
if (server) {
server.close();
}
return testSetup.teardown();
});
test('Does not hit a breakpoint in a file on load', async () => {
const testProjectRoot = path.join(DATA_ROOT, 'breakOnLoad_sourceMaps');
const scriptPath = path.join(testProjectRoot, 'src/script.ts');
server = createServer({ root: testProjectRoot });
server.listen(7890);
const url = 'http://localhost:7890/index.html';
// We try to put a breakpoint at (1,1). If this doesn't get hit, the console.log statement in the script should be executed
const bpLine = 1;
const bpCol = 1;
// Variable to track whether the concerned console.log statement gets executed
var consoleOutputLogged = false;
await Promise.all([
dc.waitForEvent('initialized').then(event => {
return dc.setBreakpointsRequest({
lines: [bpLine],
breakpoints: [{ line: bpLine, column: bpCol }],
source: { path: scriptPath }
});
}).then(response => {
return dc.configurationDoneRequest();
}),
// Add an event listener for the output event to capture the console.log statement
dc.addListener('output', function(event) {
// If console.log event statement is executed, change the variable to true
if (event.body.category === 'stdout' && event.body.output === 'Hi\n') {
consoleOutputLogged = true;
}
}),
dc.launch({ url: 'http://localhost:7890/index.html', webRoot: testProjectRoot })
]);
// Wait for sometime to make sure the page load is completed
await new Promise(resolve => setTimeout(resolve, 1500));
if (consoleOutputLogged) {
return Promise.resolve();
} else {
return Promise.reject("Console output not logged even after timeout");
}
});
});
});

Просмотреть файл

@ -13,20 +13,33 @@ import {DebugClient} from 'vscode-debugadapter-testsupport';
const DEBUG_ADAPTER = './out/src/chromeDebug.js';
function patchLaunchArgs(launchArgs: any): void {
var testBreakOnLoadStrategy: string;
function formLaunchArgs(launchArgs: any): void {
launchArgs.trace = 'verbose';
launchArgs.disableNetworkCache = true;
// Start with a clean userDataDir for each test run
const tmpDir = tmp.dirSync({ prefix: 'chrome2-' });
launchArgs.userDataDir = tmpDir.name;
if (testBreakOnLoadStrategy) {
launchArgs.breakOnLoadStrategy = testBreakOnLoadStrategy;
testBreakOnLoadStrategy = undefined;
}
}
function patchLaunchArgs(launchArgs: any): void {
formLaunchArgs(launchArgs);
}
export const lowercaseDriveLetterDirname = __dirname.charAt(0).toLowerCase() + __dirname.substr(1);
export const PROJECT_ROOT = path.join(lowercaseDriveLetterDirname, '../../../');
export const DATA_ROOT = path.join(PROJECT_ROOT, 'testdata/');
export function setup(port?: number) {
export function setup(port?: number, breakOnLoadStrategy?: string) {
if (breakOnLoadStrategy) {
testBreakOnLoadStrategy = breakOnLoadStrategy;
}
return ts.setup(DEBUG_ADAPTER, 'chrome', patchLaunchArgs, port);
}

9
testdata/breakOnLoad_javaScript/index.html поставляемый Normal file
Просмотреть файл

@ -0,0 +1,9 @@
<!doctype html>
<html>
<head>
<script src="src/script.js"></script>
</head>
<body>
<h1>testdata/breakOnLoad_javaScript</h1>
</body>
</html>

7
testdata/breakOnLoad_javaScript/src/script.js поставляемый Normal file
Просмотреть файл

@ -0,0 +1,7 @@
document.write("Script.js file"); console.log("Hi");
var a = 1;
var b = 1; fun();
function fun() {
return true;
}

9
testdata/breakOnLoad_sourceMaps/index.html поставляемый Normal file
Просмотреть файл

@ -0,0 +1,9 @@
<!doctype html>
<html>
<head>
<script src="out/script.js"></script>
</head>
<body>
<h1>testdata/breakOnLoad_sourceMaps</h1>
</body>
</html>

1
testdata/breakOnLoad_sourceMaps/out/SubDir/script.js поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
//# sourceMappingURL=script.js.map

1
testdata/breakOnLoad_sourceMaps/out/SubDir/script.js.map поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
{"version":3,"file":"script.js","sourceRoot":"","sources":["../../src/SubDir/script.ts"],"names":[],"mappings":""}

1
testdata/breakOnLoad_sourceMaps/out/script.bin.js поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
//# sourceMappingURL=script.bin.js.map

1
testdata/breakOnLoad_sourceMaps/out/script.bin.js.map поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
{"version":3,"file":"script.bin.js","sourceRoot":"","sources":["../src/script.bin.ts"],"names":[],"mappings":""}

9
testdata/breakOnLoad_sourceMaps/out/script.js поставляемый Normal file
Просмотреть файл

@ -0,0 +1,9 @@
document.write("Script.ts file");
console.log("Hi");
var a = 1;
var b = 1;
fun();
function fun() {
return true;
}
//# sourceMappingURL=script.js.map

1
testdata/breakOnLoad_sourceMaps/out/script.js.map поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
{"version":3,"file":"script.js","sourceRoot":"","sources":["../src/script.ts"],"names":[],"mappings":"AAAA,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpD,IAAI,CAAC,GAAG,CAAC,CAAC;AACV,IAAI,CAAC,GAAG,CAAC,CAAC;AAAC,GAAG,EAAE,CAAC;AAEjB;IACI,MAAM,CAAC,IAAI,CAAC;AAChB,CAAC"}

1
testdata/breakOnLoad_sourceMaps/out/script1.js поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
//# sourceMappingURL=script1.js.map

1
testdata/breakOnLoad_sourceMaps/out/script1.js.map поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
{"version":3,"file":"script1.js","sourceRoot":"","sources":["../src/script1.ts"],"names":[],"mappings":""}

7
testdata/breakOnLoad_sourceMaps/src/script.ts поставляемый Normal file
Просмотреть файл

@ -0,0 +1,7 @@
document.write("Script.ts file"); console.log("Hi");
var a = 1;
var b = 1; fun();
function fun(): boolean {
return true;
}

6
testdata/breakOnLoad_sourceMaps/tsconfig.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,6 @@
{
"compilerOptions": {
"outDir": "out",
"sourceMap": true
}
}

82
testdata/breakOnLoad_webpack/dist/bundle.js поставляемый Normal file
Просмотреть файл

@ -0,0 +1,82 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
document.write("Script.js file");
console.log("Hi");
var a = 1;
var b = 1;
fun();
function fun() {
return true;
}
/***/ })
/******/ ]);
//# sourceMappingURL=bundle.js.map

1
testdata/breakOnLoad_webpack/dist/bundle.js.map поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
{"version":3,"sources":["webpack:///webpack/bootstrap 110f404fad45858d5cd9","webpack:///./src/script.js"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;AC7DA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,C","file":"bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 110f404fad45858d5cd9","document.write(\"Script.js file\");\r\nconsole.log(\"Hi\");\r\nvar a = 1;\r\nvar b = 1;\r\nfun();\r\n\r\nfunction fun() {\r\n return true;\r\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/script.js\n// module id = 0\n// module chunks = 0"],"sourceRoot":""}

9
testdata/breakOnLoad_webpack/dist/index.html поставляемый Normal file
Просмотреть файл

@ -0,0 +1,9 @@
<!doctype html>
<html>
<head>
<script src="bundle.js"></script>
</head>
<body>
<h1>testdata/breakOnLoad_webpack</h1>
</body>
</html>

2175
testdata/breakOnLoad_webpack/package-lock.json сгенерированный поставляемый Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

8
testdata/breakOnLoad_webpack/package.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,8 @@
{
"scripts": {
"build": "webpack"
},
"devDependencies": {
"webpack": "^3.8.1"
}
}

9
testdata/breakOnLoad_webpack/src/script.js поставляемый Normal file
Просмотреть файл

@ -0,0 +1,9 @@
document.write("Script.js file");
console.log("Hi");
var a = 1;
var b = 1;
fun();
function fun() {
return true;
}

10
testdata/breakOnLoad_webpack/webpack.config.js поставляемый Normal file
Просмотреть файл

@ -0,0 +1,10 @@
const path = require('path');
module.exports = {
entry: './src/script.js',
devtool: 'source-map',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
}
};