Resolve webRoot to an absolute path
This commit is contained in:
Родитель
74d71c4722
Коммит
42e502a44c
|
@ -3,6 +3,7 @@
|
|||
*--------------------------------------------------------*/
|
||||
|
||||
import * as utils from '../webkit/utilities';
|
||||
import * as path from 'path';
|
||||
|
||||
interface IPendingBreakpoint {
|
||||
resolve: () => void;
|
||||
|
@ -20,11 +21,22 @@ export class PathTransformer implements IDebugTransformer {
|
|||
private _pendingBreakpointsByPath = new Map<string, IPendingBreakpoint>();
|
||||
|
||||
public launch(args: ILaunchRequestArgs): void {
|
||||
this._webRoot = args.webRoot || args.cwd;
|
||||
this.initWebRoot(args);
|
||||
}
|
||||
|
||||
public attach(args: IAttachRequestArgs): void {
|
||||
this._webRoot = args.webRoot || args.cwd;
|
||||
this.initWebRoot(args);
|
||||
}
|
||||
|
||||
private initWebRoot(args: ILaunchRequestArgs|IAttachRequestArgs): void {
|
||||
if (args.webRoot) {
|
||||
this._webRoot = args.webRoot
|
||||
if (!path.isAbsolute(this._webRoot)) {
|
||||
this._webRoot = path.resolve(args.cwd, this._webRoot);
|
||||
}
|
||||
} else {
|
||||
this._webRoot = args.cwd;
|
||||
}
|
||||
}
|
||||
|
||||
public setBreakpoints(args: ISetBreakpointsArgs): Promise<void> {
|
||||
|
|
|
@ -25,7 +25,7 @@ suite('PathTransformer', () => {
|
|||
setup(() => {
|
||||
testUtils.setupUnhandledRejectionListener();
|
||||
mockery.enable({ useCleanCache: true, warnOnReplace: false });
|
||||
mockery.registerAllowables([MODULE_UNDER_TEST]);
|
||||
mockery.registerAllowables([MODULE_UNDER_TEST, 'path']);
|
||||
|
||||
// Mock the utils functions
|
||||
const mockedObj = testUtils.getDefaultUtilitiesMock();
|
||||
|
|
|
@ -5,12 +5,13 @@
|
|||
{
|
||||
"name": "test chrome",
|
||||
"type": "chrome",
|
||||
"file": "out/client/index.html",
|
||||
// "file": "out/client/index.html",
|
||||
"request": "launch",
|
||||
//"url": "http://localhost:8080/out/client/index.html",
|
||||
"url": "http://localhost:8080/client/index.html",
|
||||
"sourceMaps": true,
|
||||
"outDir": "out",
|
||||
"diagnosticLogging": true
|
||||
"diagnosticLogging": true,
|
||||
"webRoot": "out"
|
||||
},
|
||||
{
|
||||
"name": "attach to chrome",
|
||||
|
|
|
@ -154,7 +154,7 @@ export class Logger {
|
|||
this._logger._diagnosticLogCallback = logCallback;
|
||||
|
||||
if (isServer) {
|
||||
Logger.logDiagnosticInfo();
|
||||
Logger.logVersionInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -163,12 +163,12 @@ export class Logger {
|
|||
if (this._logger) {
|
||||
this._logger._diagnosticLoggingEnabled = true;
|
||||
if (!this._logger._isServer) {
|
||||
Logger.logDiagnosticInfo();
|
||||
Logger.logVersionInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static logDiagnosticInfo(): void {
|
||||
public static logVersionInfo(): void {
|
||||
Logger.log(`OS: ${os.platform()} ${os.arch()}`);
|
||||
Logger.log('Node version: ' + process.version);
|
||||
Logger.log('Adapter version: ' + require('../../package.json').version);
|
||||
|
|
Загрузка…
Ссылка в новой задаче