Merge branch 'main' into tyler/shouldonlypush

This commit is contained in:
Connor Peet 2023-03-03 10:16:27 -08:00
Родитель dc55084d06 cd4fe8e3d2
Коммит fe1ba6140e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CF8FD2EA0DBC61BD
74 изменённых файлов: 1705 добавлений и 3143 удалений

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

@ -17,6 +17,8 @@ steps:
- task: Npm@1
displayName: npm install
inputs:
command: custom
customCommand: install --legacy-peer-deps
verbose: false
- task: NodeTool@0

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

@ -23,7 +23,7 @@ extends:
cgIgnoreDirectories: 'testdata,demos,.vscode-test'
l10nShouldProcess: false
buildSteps:
- script: npm install
- script: npm install --legacy-peer-deps
displayName: Install dependencies
- script: npm run compile -- package:prepare --nightly

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

@ -35,7 +35,7 @@ extends:
l10nPackageNlsPath: ../package.nls.json
l10nSourcePaths: ../src
buildSteps:
- script: npm install
- script: npm install --legacy-peer-deps
displayName: Install dependencies
- script: npm run compile -- package:prepare

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

@ -1,5 +1,5 @@
module.exports = {
require: ['source-map-support/register', './out/src/test/testHooks'],
spec: 'out/src/**/*.test.js',
ignore: ['out/src/test/**/*.js'],
require: ['source-map-support/register', './src/test/testHooks.ts'],
spec: 'src/**/*.test.ts',
ignore: ['src/test/**/*.ts'],
};

26
.vscode/launch.json поставляемый
Просмотреть файл

@ -17,7 +17,7 @@
"type": "node",
"request": "launch",
"name": "Debug Server",
"program": "${workspaceFolder}/out/src/debugServerMain.js",
"program": "${workspaceFolder}/dist/src/debugServerMain.js",
"args": [
"4711"
]
@ -28,7 +28,7 @@
"request": "launch",
"name": "Debug Server (Flat Session)",
"trace": true,
"program": "${workspaceFolder}/out/src/flatSessionLauncher.js",
"program": "${workspaceFolder}/dist/src/flatSessionLauncher.js",
"args": [
"4712"
],
@ -42,7 +42,7 @@
"request": "launch",
"name": "Debug Server (VS Server)",
"trace": true,
"program": "${workspaceFolder}/out/src/vsDebugServer.js",
"program": "${workspaceFolder}/dist/src/vsDebugServer.js",
"args": [
"4712"
],
@ -60,11 +60,11 @@
],
"args": [
"--enable-proposed-api=ms-vscode.js-debug",
"--extensionDevelopmentPath=${workspaceFolder}/out",
"--extensionDevelopmentPath=${workspaceFolder}/dist",
"--extensionDevelopmentPath=${workspaceFolder}/../vscode-hexeditor",
],
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"${workspaceFolder}/dist/**/*.js",
"${workspaceFolder}/../vscode/extensions/debug-auto-launch/out/**/*.js"
]
// "preLaunchTask": "npm: watch"
@ -95,7 +95,7 @@
"args": [
"--enable-proposed-api=ms-vscode.js-debug",
"--extensionDevelopmentPath=${workspaceFolder}/../vscode/extensions/debug-auto-launch",
"--extensionDevelopmentPath=${workspaceFolder}/out"
"--extensionDevelopmentPath=${workspaceFolder}/dist"
],
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
@ -103,7 +103,7 @@
"!**/node_modules/**"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"${workspaceFolder}/dist/**/*.js",
"${workspaceFolder}/../vscode-js-debug-companion/out/**/*.js"
]
},
@ -117,7 +117,7 @@
"args": [
"--enable-proposed-api=ms-vscode.js-debug",
"--extensionDevelopmentPath=${workspaceFolder}/../vscode-js-debug-companion",
"--extensionDevelopmentPath=${workspaceFolder}/out"
"--extensionDevelopmentPath=${workspaceFolder}/dist"
],
"env": {
"JS_DEBUG_USE_COMPANION": "1"
@ -129,7 +129,7 @@
"!**/node_modules/**"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"${workspaceFolder}/dist/**/*.js",
"${workspaceFolder}/../vscode-js-debug-companion/out/**/*.js"
]
},
@ -141,11 +141,11 @@
"<node_internals>/**"
],
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/out",
"--extensionTestsPath=${workspaceFolder}/out/src/test/testRunner"
"--extensionDevelopmentPath=${workspaceFolder}/dist",
"--extensionTestsPath=${workspaceFolder}/dist/src/testRunner"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
"${workspaceFolder}/dist/**/*.js"
]
},
{
@ -161,7 +161,7 @@
".mocharc.unit.js"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
"${workspaceFolder}/dist/**/*.js"
]
},
{

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

@ -1,23 +1,4 @@
.cache/**/*
.headless-profile/**/*
.vscode/**/*
.vscode-test/**/*
.profile/**/*
demos/**/*
node_modules/**/*
out/**/*
!out/extension.js
!out/bootloader.js
!out/watchdog.js
!out/mappings.wasm
scripts/**/*
src/**/*
testWorkspace/**/*
.gitignore
.vscodeignore
build.sh
**/*.md
package-lock.json
testdata/**/*
.ci/**/*
gulpfile.js
# note: this is moved into `dist` during compilation, and does not actually apply here
**/*.map
src/build/**
src/testRunner.js

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

@ -4,8 +4,22 @@ This changelog records changes to stable releases since 1.50.2. "TBA" changes he
## Nightly (only)
- fix: repl stacktrace with renames showing too much info ([#1259](https://github.com/microsoft/vscode-js-debug/issues/1259#issuecomment-1409443564))
- fix: recursive source map resolution parsing ignored locations ([vscode#169733](https://github.com/microsoft/vscode/issues/169733))
- fix: unbound breakpoints in sourcemaps on Chrome 112 ([#1567](https://github.com/microsoft/vscode-js-debug/issues/1567))
- chore: remove webpack, adopt esbuild
## v1.76 (February 2023)
### v1.76.0 - 2023-02-22
- fix: typeerror for users of vsDebugServer.bundle.js ([#1502](https://github.com/microsoft/vscode-js-debug/issues/1502))
- fix: don't fail on dynamic config provisioning if no package.json's exist ([vscode#172522](https://github.com/microsoft/vscode/issues/172522))
- fix: expansion of non-primitive getters not working ([#1525](https://github.com/microsoft/vscode-js-debug/issues/1525))
- fix: support rich ANSI output for complex logs ([vscode#172868](https://github.com/microsoft/vscode/issues/172868))
- fix: source map resolution in parent workspace folder paths not working ([#1554 comment](https://github.com/microsoft/vscode-js-debug/issues/1554#issuecomment-1420520834))
- fix: revert support for renamed property accessors ([#1561](https://github.com/microsoft/vscode-js-debug/issues/1561))
- fix: resolveSourceMapLocations not being auto-filled for ext host debug ([#1554 comment](https://github.com/microsoft/vscode-js-debug/issues/1554#issuecomment-1420520834))
## v1.75 (January 2023)

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

@ -7,48 +7,43 @@ const filter = require('gulp-filter');
const gulp = require('gulp');
const minimist = require('minimist');
const path = require('path');
const sourcemaps = require('gulp-sourcemaps');
const tsb = require('gulp-tsb');
const rename = require('gulp-rename');
const merge = require('merge2');
const vsce = require('vsce');
const webpack = require('webpack');
const execSync = require('child_process').execSync;
const fs = require('fs');
const cp = require('child_process');
const util = require('util');
const deepmerge = require('deepmerge');
const unzipper = require('unzipper');
const signale = require('signale');
const streamBuffers = require('stream-buffers');
const got = require('got').default;
const execa = require('execa');
const esbuild = require('esbuild');
const esbuildPlugins = require('./src/build/esbuildPlugins');
const dirname = 'js-debug';
const sources = ['src/**/*.{ts,tsx}'];
const allPackages = [];
const buildDir = 'out';
const srcDir = 'src';
const buildDir = 'dist';
const buildSrcDir = `${buildDir}/src`;
const distDir = 'dist';
const distSrcDir = `${distDir}/src`;
const nodeTargetsDir = `targets/node`;
const isWatch = process.argv.includes('watch') || process.argv.includes('--watch');
/**
* Whether we're running a nightly build.
*/
const isNightly = process.argv.includes('--nightly') || process.argv.includes('watch');
const isNightly = process.argv.includes('--nightly') || isWatch;
/**
* Extension ID to build. Appended with '-nightly' as necessary.
*/
const extensionName = isNightly ? 'js-debug-nightly' : 'js-debug';
function runBuildScript(name) {
async function runBuildScript(name) {
return new Promise((resolve, reject) =>
cp.execFile(
process.execPath,
[path.join(__dirname, 'out', 'src', 'build', name)],
[path.join(__dirname, buildDir, 'src', 'build', name)],
(err, stdout, stderr) => {
process.stderr.write(stderr);
if (err) {
@ -74,27 +69,9 @@ async function readJson(file) {
return JSON.parse(contents);
}
const tsProject = tsb.create('./tsconfig.json');
gulp.task('clean-assertions', () => del(['src/test/**/*.txt.actual']));
gulp.task('clean', () =>
del(['out/**', 'dist/**', 'src/*/package.nls.*.json', 'packages/**', '*.vsix']),
);
gulp.task('compile:ts', () =>
tsProject
.src()
.pipe(sourcemaps.init())
.pipe(tsProject())
.pipe(
sourcemaps.write('.', {
includeContent: false,
sourceRoot: '../../src',
}),
)
.pipe(gulp.dest(buildSrcDir)),
);
gulp.task('clean', () => del(['dist/**', 'src/*/package.nls.*.json', 'packages/**', '*.vsix']));
async function fixNightlyReadme() {
const readmePath = `${buildDir}/README.md`;
@ -122,6 +99,39 @@ const getVersionNumber = () => {
].join('.');
};
const cachedBuilds = new Map();
const incrementalEsbuild = async (/** @type {esbuild.BuildOptions} */ options) => {
const key = JSON.stringify(options);
if (cachedBuilds.has(key)) {
return cachedBuilds.get(key).rebuild();
}
if (!isWatch) {
const r = await esbuild.build(options);
if (r.metafile) {
console.log(await esbuild.analyzeMetafile(r.metafile));
}
return;
}
const ctx = await esbuild.context(options);
cachedBuilds.set(key, ctx);
await ctx.rebuild();
};
gulp.task('compile:build-scripts', () =>
incrementalEsbuild({
entryPoints: fs
.readdirSync('src/build')
.filter(f => f.endsWith('.ts'))
.map(f => `src/build/${f}`),
outdir: `${buildDir}/src/build`,
bundle: true,
platform: 'node',
}),
);
gulp.task('compile:dynamic', async () => {
const [contributions, strings] = await Promise.all([
runBuildScript('generate-contributions'),
@ -129,7 +139,7 @@ gulp.task('compile:dynamic', async () => {
runBuildScript('documentReadme'),
]);
let packageJson = await readJson(`${buildDir}/package.json`);
let packageJson = await readJson('package.json');
packageJson.name = extensionName;
if (isNightly) {
packageJson.displayName += ' (Nightly)';
@ -141,115 +151,62 @@ gulp.task('compile:dynamic', async () => {
packageJson = deepmerge(packageJson, contributions);
return Promise.all([
writeFile(`${buildDir}/package.json`, JSON.stringify(packageJson, null, 2)),
writeFile(`${buildDir}/package.nls.json`, JSON.stringify(strings, null, 2)),
writeFile(`${buildDir}/package.json`, JSON.stringify(packageJson)),
writeFile(`${buildDir}/package.nls.json`, JSON.stringify(strings)),
]);
});
gulp.task('compile:static', () =>
merge(
gulp.src(['LICENSE', 'package.json']),
gulp.src(['resources/**/*', 'README.md', 'src/**/*.sh'], { base: '.' }),
gulp.src(['LICENSE', 'resources/**/*', 'README.md', 'src/**/*.sh', '.vscodeignore'], { base: '.' }),
gulp
.src(['node_modules/source-map/lib/*.wasm', 'node_modules/@c4312/chromehash/pkg/*.wasm'])
.pipe(rename({ dirname: 'src' })),
).pipe(gulp.dest(buildDir)),
);
/** Compiles supporting libraries to single bundles in the output */
gulp.task(
'compile:webpack-supporting',
gulp.parallel(
() => runWebpack({ devtool: 'source-map', compileInPlace: true }),
() =>
gulp
.src('node_modules/@c4312/chromehash/pkg/*.wasm')
.pipe(gulp.dest(`${buildSrcDir}/common/hash`)),
),
);
gulp.task(
'compile',
gulp.series('compile:ts', 'compile:static', 'compile:dynamic', 'compile:webpack-supporting'),
);
const resolveDefaultExts = ['.tsx', '.ts', '.jsx', '.js', '.css', '.json'];
async function runWebpack({
async function compileTs({
packages = [],
devtool = false,
sourcemap = false,
compileInPlace = false,
mode = process.argv.includes('watch') ? 'development' : 'production',
minify = isWatch ? false : true,
watch = false,
} = options) {
// add the entrypoints common to both vscode and vs here
packages = [
...packages,
{ entry: `${buildSrcDir}/common/hash/hash.js`, library: false },
{ entry: `${buildSrcDir}/${nodeTargetsDir}/bootloader.js`, library: false },
{ entry: `${buildSrcDir}/${nodeTargetsDir}/watchdog.js`, library: false },
{ entry: `${buildSrcDir}/diagnosticTool/diagnosticTool.js`, library: false, target: 'web' },
{ entry: `${srcDir}/common/hash/hash.ts`, library: false },
{ entry: `${srcDir}/targets/node/bootloader.ts`, library: false },
{ entry: `${srcDir}/targets/node/watchdog.ts`, library: false },
{ entry: `${srcDir}/diagnosticTool/diagnosticTool.tsx`, library: false, target: 'browser' },
];
let todo = [];
for (const { entry, target, library, filename, isInExtension } of packages) {
const config = {
mode,
target: target || 'async-node',
entry: path.resolve(entry),
output: {
path: compileInPlace ? path.resolve(path.dirname(entry)) : path.resolve(distSrcDir),
filename: filename || path.basename(entry).replace('.js', '.bundle.js'),
devtoolModuleFilenameTemplate: '../[resource-path]',
},
devtool: devtool,
resolve: {
extensions: isInExtension ? ['.js', '.json'] : ['.js', '.json'],
alias: {
// their .mjs seems broken:
acorn: require.resolve('acorn'),
'acorn-loose': require.resolve('acorn-loose'),
},
fallback: { path: require.resolve('path-browserify') },
},
module: {
rules: [
{
test: '\\.node$', // will be regex'd in the webpackBuild script
loader: 'node-loader',
},
{
test: '\\.css$', // will be regex'd in the webpackBuild script
use: ['style-loader', 'css-loader'],
},
],
},
plugins: [],
node: {
__dirname: false,
__filename: false,
},
externals: {
vscode: 'commonjs vscode',
},
};
if (library) {
config.output.libraryTarget = 'commonjs2';
}
if (isInExtension) {
config.resolve.alias['@vscode/l10n'] = path.resolve(
__dirname,
`${buildSrcDir}/common/l10n.extensionOnly.js`,
);
}
for (const { entry, target = 'node', library, isInVsCode, nodePackages } of packages) {
todo.push(
execa('node', [path.join(__dirname, 'src/build/webpackBuild')], {
stdio: 'inherit',
env: {
...process.env,
CONFIG: JSON.stringify(config),
ANALYZE_SIZE: String(process.argv.includes('--analyze-size')),
WATCH: String(watch),
USE_VSCODE_L10N: Boolean(isInExtension),
},
incrementalEsbuild({
entryPoints: [entry],
platform: target,
bundle: true,
outdir: buildSrcDir,
resolveExtensions: isInVsCode
? ['.extensionOnly.ts', ...resolveDefaultExts]
: resolveDefaultExts,
external: isInVsCode ? ['vscode'] : [],
sourcemap: !!sourcemap,
sourcesContent: false,
packages: nodePackages,
minify,
alias: target === 'node' ? {} : { path: 'path-browserify' },
plugins: [
esbuildPlugins.nativeNodeModulesPlugin(),
esbuildPlugins.importGlobLazy(),
esbuildPlugins.dirname(/src.test./),
],
format: library ? 'cjs' : 'iife',
}),
);
}
@ -258,57 +215,41 @@ async function runWebpack({
}
/** Run webpack to bundle the extension output files */
gulp.task('package:webpack-bundle', async () => {
gulp.task('compile:extension', async () => {
const packages = [
{ entry: `${srcDir}/extension.ts`, library: true, isInVsCode: true },
{
entry: `${buildSrcDir}/extension.js`,
filename: 'extension.js',
entry: `${srcDir}/test/testRunner.ts`,
library: true,
isInExtension: true,
isInVsCode: true,
nodePackages: 'external',
},
];
return runWebpack({ packages });
return compileTs({ packages, sourcemap: true });
});
gulp.task(
'compile',
gulp.series('compile:static', 'compile:build-scripts', 'compile:dynamic', 'compile:extension'),
);
/** Run webpack to bundle into the flat session launcher (for VS or standalone debug server) */
gulp.task('flatSessionBundle:webpack-bundle', async () => {
const packages = [{ entry: `${buildSrcDir}/flatSessionLauncher.js`, library: true }];
return runWebpack({ packages, devtool: 'nosources-source-map' });
const packages = [{ entry: `${srcDir}/flatSessionLauncher.ts`, library: true }];
return compileTs({ packages, sourcemap: true });
});
gulp.task('package:bootloader-as-cdp', done => {
const bootloaderFilePath = path.resolve(distSrcDir, 'bootloader.bundle.js');
const bootloaderFilePath = path.resolve(buildSrcDir, 'bootloader.js');
fs.appendFile(bootloaderFilePath, '\n//# sourceURL=bootloader.bundle.cdp', done);
});
/** Run webpack to bundle into the VS debug server */
gulp.task('vsDebugServerBundle:webpack-bundle', async () => {
const packages = [{ entry: `${buildSrcDir}/vsDebugServer.js`, library: true }];
return runWebpack({ packages, devtool: 'nosources-source-map' });
const packages = [{ entry: `${srcDir}/vsDebugServer.ts`, library: true }];
return compileTs({ packages, sourcemap: true });
});
/** Copy the extension static files */
gulp.task('package:copy-extension-files', () =>
merge(
gulp.src(
[
`${buildDir}/LICENSE`,
`${buildDir}/package.json`,
`${buildDir}/package.*.json`,
`${buildDir}/resources/**/*`,
`${buildDir}/README.md`,
],
{
base: buildDir,
},
),
gulp
.src(['node_modules/source-map/lib/*.wasm', 'node_modules/@c4312/chromehash/pkg/*.wasm'])
.pipe(rename({ dirname: 'src' })),
gulp.src(`${buildDir}/src/**/*.sh`).pipe(rename({ dirname: 'src' })),
).pipe(gulp.dest(distDir)),
);
const vsceUrls = {
baseContentUrl: 'https://github.com/microsoft/vscode-js-debug/blob/main',
baseImagesUrl: 'https://github.com/microsoft/vscode-js-debug/raw/main',
@ -318,9 +259,9 @@ const vsceUrls = {
gulp.task('package:createVSIX', () =>
vsce.createVSIX({
...vsceUrls,
cwd: distDir,
cwd: buildDir,
useYarn: true,
packagePath: path.join(distDir, `${extensionName}.vsix`),
packagePath: path.join(buildDir, `${extensionName}.vsix`),
}),
);
@ -329,12 +270,11 @@ gulp.task(
'package:prepare',
gulp.series(
'clean',
'compile:ts',
'compile:static',
'compile:build-scripts',
'compile:dynamic',
'package:webpack-bundle',
'compile:extension',
'package:bootloader-as-cdp',
'package:copy-extension-files',
'package:createVSIX',
),
);
@ -343,13 +283,7 @@ gulp.task('package', gulp.series('package:prepare', 'package:createVSIX'));
gulp.task(
'flatSessionBundle',
gulp.series(
'clean',
'compile',
'flatSessionBundle:webpack-bundle',
'package:bootloader-as-cdp',
'package:copy-extension-files',
),
gulp.series('clean', 'compile', 'flatSessionBundle:webpack-bundle', 'package:bootloader-as-cdp'),
);
// for now, this task will build both flat session and debug server until we no longer need flat session
@ -361,7 +295,6 @@ gulp.task(
'vsDebugServerBundle:webpack-bundle',
'flatSessionBundle:webpack-bundle',
'package:bootloader-as-cdp',
'package:copy-extension-files',
),
);
@ -372,7 +305,7 @@ gulp.task('publish:vsce', () =>
noVerify: true, // for proposed API usage
pat: process.env.MARKETPLACE_TOKEN,
useYarn: true,
cwd: distDir,
cwd: buildDir,
}),
);
@ -382,11 +315,7 @@ gulp.task('default', gulp.series('compile'));
gulp.task(
'watch',
gulp.series('clean', 'compile', done => {
gulp.watch(
[...sources, '*.json'],
gulp.series('compile:ts', 'compile:static', 'compile:dynamic'),
);
runWebpack({ watch: true, devtool: 'source-map', compileInPlace: true });
gulp.watch([...sources, '*.json'], gulp.series('compile'));
done();
}),
);

3413
package-lock.json сгенерированный

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

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

@ -1,7 +1,7 @@
{
"name": "js-debug",
"displayName": "JavaScript Debugger",
"version": "1.75.0",
"version": "1.76.0",
"publisher": "ms-vscode",
"author": {
"name": "Microsoft Corporation"
@ -40,11 +40,11 @@
"publish": "gulp publish",
"updatetypes": "cd src/typings && npx vscode-dts dev && npx vscode-dts master",
"updatenodeapi": "python src/build/getNodePdl.py && prettier --write src/build/nodeCustom.ts",
"generateapis": "node out/src/build/generateDap.js && node out/src/build/generateCdp.js",
"generateapis": "node dist/src/build/generateDap.js && node dist/src/build/generateCdp.js",
"test": "gulp && npm-run-all --parallel test:unit test:types test:golden test:lint",
"test:types": "tsc --noEmit",
"test:unit": "mocha --config .mocharc.unit.js",
"test:golden": "node ./out/src/test/runTest.js",
"test:unit": "tsx node_modules/mocha/bin/mocha.js --config .mocharc.unit.js",
"test:golden": "node ./src/test/runTest.js",
"test:lint": "gulp lint"
},
"dependencies": {
@ -62,7 +62,7 @@
"estraverse": "^5.3.0",
"execa": "^5.1.1",
"glob-stream": "^7.0.0",
"got": "^11.8.5",
"got": "^11.8.6",
"inversify": "^6.0.1",
"js-xxhash": "^1.0.4",
"jsonc-parser": "^3.0.0",
@ -129,10 +129,10 @@
"chai-as-promised": "^7.1.1",
"chai-string": "^1.5.0",
"chai-subset": "^1.6.0",
"css-loader": "^6.7.1",
"deepmerge": "^4.2.2",
"del": "^6.0.0",
"diff": "^5.0.0",
"esbuild": "^0.17.10",
"eslint": "^8.12.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-react": "^7.29.4",
@ -142,32 +142,26 @@
"gulp-cli": "^2.3.0",
"gulp-filter": "^7.0.0",
"gulp-rename": "^2.0.0",
"gulp-sourcemaps": "^3.0.0",
"gulp-tsb": "^4.0.6",
"gulp-util": "^3.0.8",
"husky": "^7.0.4",
"marked": "^4.0.12",
"merge2": "^1.4.1",
"minimist": "^1.2.6",
"mocha": "^9.2.2",
"mocha": "^10.2.0",
"mocha-junit-reporter": "^2.0.2",
"mocha-multi-reporters": "^1.5.1",
"node-loader": "^2.0.0",
"npm-run-all": "^4.1.5",
"nyc": "^15.1.0",
"playwright": "^1.26.0",
"prettier": "^2.6.1",
"sinon": "^13.0.1",
"stream-buffers": "^3.0.2",
"style-loader": "^3.3.1",
"ts-node": "^10.7.0",
"tsx": "^3.12.3",
"typescript": "^4.6.3",
"unzipper": "^0.10.11",
"vsce": "^2.7.0",
"vscode-debugadapter-testsupport": "^1.47.0",
"vscode-debugprotocol": "^1.47.0",
"webpack": "^5.70.0",
"webpack-bundle-analyzer": "^4.5.0"
"vscode-debugprotocol": "^1.47.0"
},
"main": "./src/extension.js",
"enabledApiProposals": [

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

@ -5,7 +5,7 @@
import { inject, injectable } from 'inversify';
import Cdp from '../cdp/api';
import { ILogger, LogTag } from '../common/logging';
import { bisectArray } from '../common/objUtils';
import { bisectArray, flatten } from '../common/objUtils';
import { IPosition } from '../common/positions';
import { delay } from '../common/promiseUtil';
import { SourceMap } from '../common/sourceMaps/sourceMap';
@ -193,7 +193,7 @@ export class BreakpointManager {
}
}
return (await Promise.all(todo)).reduce((a, b) => [...a, ...b], []);
return flatten(await Promise.all(todo));
};
}

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

@ -3,7 +3,7 @@
*--------------------------------------------------------*/
import { expect } from 'chai';
import { delay } from '../../common/promiseUtil';
import { delay, getDeferred } from '../../common/promiseUtil';
import { ReservationQueue } from './reservationQueue';
describe('ReservationQueue', () => {
@ -28,9 +28,22 @@ describe('ReservationQueue', () => {
});
it('enqueues async with order', async () => {
queue.enqueue(delay(6).then(() => 1));
queue.enqueue(delay(2).then(() => 2));
queue.enqueue(delay(4).then(() => 3));
const gate1 = getDeferred<void>();
const gate2 = getDeferred<void>();
queue.enqueue(gate2.promise.then(() => 1));
queue.enqueue(
delay(1).then(() => {
gate1.resolve();
return 2;
}),
);
queue.enqueue(
gate1.promise.then(() => {
gate2.resolve();
return 3;
}),
);
await delay(10);
expect(sunk).to.deep.equal([[1, 2, 3]]);
});

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

@ -117,7 +117,7 @@ export abstract class TextualMessage<T extends { stackTrace?: Cdp.Runtime.StackT
includeStackInVariables ? this.stackTrace(thread) : undefined,
);
return { output: '', variablesReference: outputVar.id };
return { output, variablesReference: outputVar.id };
}
}

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

@ -9,7 +9,7 @@ import { mapValues } from '../common/objUtils';
import { ISourceMapMetadata } from '../common/sourceMaps/sourceMap';
import { AnyLaunchConfiguration } from '../configuration';
import Dap from '../dap/api';
import { toolPath } from '../diagnosticTool';
import { toolPath, toolStylePath } from '../diagnosticTool';
import { FS, FsPromises } from '../ioc-extras';
import { ITarget } from '../targets/targets';
import { BreakpointManager } from './breakpoints';
@ -95,6 +95,7 @@ export class Diagnostics {
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>${await this.fs.readFile(toolStylePath, 'utf-8')}<</style>
</head>
<body>
<script>window.DUMP=${JSON.stringify(await this.generateObject())}</script>

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

@ -274,7 +274,8 @@ export class Evaluator implements IEvaluator {
});
const parents: Node[] = [];
const transformed = replace(parseProgram(expr), {
const program = parseProgram(expr);
const transformed = replace(program, {
enter(node, parent) {
const asAcorn = node as AcornNode;
if (node.type !== 'Identifier' || expr[asAcorn.start - 1] === '.') {
@ -305,7 +306,14 @@ export class Evaluator implements IEvaluator {
},
});
return { hoisted, transformed: mutated ? generate(transformed) : expr };
if (!mutated) {
return { hoisted, transformed: expr };
}
// preserve any trailing comment, which might be something like `sourceURL=...`
// see https://github.com/microsoft/vscode-js-debug/issues/1259#issuecomment-1442584596
const stmtsEnd = (program.body[program.body.length - 1] as AcornNode).end;
return { hoisted, transformed: generate(transformed) + expr.slice(stmtsEnd) };
}
}

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

@ -1124,6 +1124,17 @@ export class SourceContainer {
sourceMapUrl = rawSmUri;
}
}
if (absolutePath && sourceMapUrl) {
const smMetadata: ISourceMapMetadata = {
sourceMapUrl,
compiledPath: absolutePath,
};
if (!this.sourcePathResolver.shouldResolveSourceMap(smMetadata)) {
sourceMapUrl = undefined;
}
}
}
const source = new SourceFromMap(

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

@ -108,7 +108,6 @@ export type Script = {
export type ScriptWithSourceMapHandler = (
script: Script,
sources: Source[],
brokenOn?: Cdp.Debugger.Location,
) => Promise<IUiLocation[]>;
export type SourceMapDisabler = (hitBreakpoints: string[]) => ISourceWithMap[];
@ -147,6 +146,13 @@ const getReplSourceSuffix = () =>
sourceUtils.SourceConstants.ReplExtension
}\n`;
/** Auxillary data present in Cdp.Debugger.Paused events in recent Chrome versions */
interface IInstrumentationPauseAuxData {
scriptId: string;
url: string;
sourceMapURL: string;
}
export class Thread implements IVariableStoreLocationProvider {
private static _lastThreadId = 0;
public readonly id: number;
@ -807,11 +813,11 @@ export class Thread implements IVariableStoreLocationProvider {
// https://github.com/denoland/deno/blob/2703996dea73c496d79fcedf165886a1659622d1/core/inspector.rs#L571
const isInspectBrk =
(event.reason as string) === 'Break on start' || event.reason === 'debugCommand';
const location = event.callFrames[0].location;
const scriptId = event.data?.scriptId || location.scriptId;
const location = event.callFrames[0]?.location as Cdp.Debugger.Location | undefined;
const scriptId = (event.data as IInstrumentationPauseAuxData)?.scriptId || location?.scriptId;
const isSourceMapPause =
(event.reason === 'instrumentation' && event.data?.scriptId) ||
this._breakpointManager.isEntrypointBreak(hitBreakpoints, scriptId);
(scriptId && this._breakpointManager.isEntrypointBreak(hitBreakpoints, scriptId));
this.evaluator.setReturnedValue(event.callFrames[0]?.returnValue);
if (isSourceMapPause) {
@ -826,7 +832,7 @@ export class Thread implements IVariableStoreLocationProvider {
event.data.__rewriteAs = 'breakpoint';
}
if (await this._handleSourceMapPause(scriptId, location)) {
if (scriptId && (await this._handleSourceMapPause(scriptId, location))) {
// Pause if we just resolved a breakpoint that's on this
// location; this won't have existed before now.
} else if (isInspectBrk) {
@ -1483,7 +1489,10 @@ export class Thread implements IVariableStoreLocationProvider {
* Wait for source map to load and set all breakpoints in this particular
* script. Returns true if the debugger should remain paused.
*/
async _handleSourceMapPause(scriptId: string, brokenOn: Cdp.Debugger.Location): Promise<boolean> {
async _handleSourceMapPause(
scriptId: string,
brokenOn?: Cdp.Debugger.Location,
): Promise<boolean> {
this._pausedForSourceMapScriptId = scriptId;
const perScriptTimeout = this._sourceContainer.sourceMapTimeouts().sourceMapMinPause;
const timeout =
@ -1496,10 +1505,7 @@ export class Thread implements IVariableStoreLocationProvider {
}
const timer = new HrTime();
const result = await Promise.race([
this._getOrStartLoadingSourceMaps(script, brokenOn),
delay(timeout),
]);
const result = await Promise.race([this._getOrStartLoadingSourceMaps(script), delay(timeout)]);
const timeSpentWallClockInMs = timer.elapsed().ms;
const sourceMapCumulativePause =
@ -1530,16 +1536,12 @@ export class Thread implements IVariableStoreLocationProvider {
console.assert(this._pausedForSourceMapScriptId === scriptId);
this._pausedForSourceMapScriptId = undefined;
return (
!!result &&
result
.map(base1To0)
.some(
b =>
b.lineNumber === brokenOn.lineNumber &&
(brokenOn.columnNumber === undefined || brokenOn.columnNumber === b.columnNumber),
)
);
const bLine = brokenOn?.lineNumber || 0;
const bColumn = brokenOn?.columnNumber;
return !!result
?.map(base1To0)
.some(b => b.lineNumber === bLine && (bColumn === undefined || bColumn === b.columnNumber));
}
/**
@ -1547,7 +1549,7 @@ export class Thread implements IVariableStoreLocationProvider {
* haven't already done so. Returns a promise that resolves with the
* handler's results.
*/
private _getOrStartLoadingSourceMaps(script: Script, brokenOn?: Cdp.Debugger.Location) {
private _getOrStartLoadingSourceMaps(script: Script) {
const existing = this._sourceMapLoads.get(script.scriptId);
if (existing) {
return existing;
@ -1557,7 +1559,7 @@ export class Thread implements IVariableStoreLocationProvider {
.then(source => this._sourceContainer.waitForSourceMapSources(source))
.then(sources =>
sources.length && this._scriptWithSourceMapHandler
? this._scriptWithSourceMapHandler(script, sources, brokenOn)
? this._scriptWithSourceMapHandler(script, sources)
: [],
);

119
src/build/esbuildPlugins.js Normal file
Просмотреть файл

@ -0,0 +1,119 @@
const glob = require('glob');
const path = require('path');
const fs = require('fs');
exports.dirname = filter => ({
name: 'dirname',
setup: build => {
build.onLoad({ filter }, async ({ path: filePath }) => {
const contents = await fs.promises.readFile(filePath, 'utf-8');
return {
contents: contents
.replace(/__dirname/g, JSON.stringify(path.dirname(filePath)))
.replace(/__filename/g, JSON.stringify(path.dirname(filePath))),
loader: path.extname(filePath).slice(1),
};
});
},
});
// https://github.com/evanw/esbuild/issues/1051#issuecomment-806325487
exports.nativeNodeModulesPlugin = () => ({
name: 'native-node-modules',
setup(build) {
// If a ".node" file is imported within a module in the "file" namespace, resolve
// it to an absolute path and put it into the "node-file" virtual namespace.
build.onResolve({ filter: /\.node$/, namespace: 'file' }, args => ({
path: require.resolve(args.path, { paths: [args.resolveDir] }),
namespace: 'node-file',
}));
// Files in the "node-file" virtual namespace call "require()" on the
// path from esbuild of the ".node" file in the output directory.
build.onLoad({ filter: /.*/, namespace: 'node-file' }, args => ({
contents: `
import path from ${JSON.stringify(args.path)}
try { module.exports = require(path) }
catch {}
`,
}));
// If a ".node" file is imported within a module in the "node-file" namespace, put
// it in the "file" namespace where esbuild's default loading behavior will handle
// it. It is already an absolute path since we resolved it to one above.
build.onResolve({ filter: /\.node$/, namespace: 'node-file' }, args => ({
path: args.path,
namespace: 'file',
}));
// Tell esbuild's default loading behavior to use the "file" loader for
// these ".node" files.
let opts = build.initialOptions;
opts.loader = opts.loader || {};
opts.loader['.node'] = 'file';
},
});
/**
* Based on https://github.com/thomaschaaf/esbuild-plugin-import-glob,
* but modified so imports are async in order to work with mocha's loading,
* which requires events around file loads.
*
* @license
*
* MIT License
*
* Copyright (c) 2021 Thomas Schaaf
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
exports.importGlobLazy = () => ({
name: 'import-glob-lazy',
setup: build => {
build.onResolve({ filter: /\*/ }, async args => {
if (args.resolveDir === '') {
return; // Ignore unresolvable paths
}
return {
path: args.path,
namespace: 'import-glob-lazy',
pluginData: {
resolveDir: args.resolveDir,
},
};
});
build.onLoad({ filter: /.*/, namespace: 'import-glob-lazy' }, async args => {
const files = glob
.sync(args.path, {
cwd: args.pluginData.resolveDir,
})
.sort()
.map(m => `[${JSON.stringify(m)}, () => import(${JSON.stringify(`./${m}`)})]`);
const importerCode = `
const modules = new Map([${files.join(',\n')}]);
export default modules;
`;
return { contents: importerCode, resolveDir: args.pluginData.resolveDir };
});
},
});

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

@ -1,55 +0,0 @@
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
const path = require('path');
const config = JSON.parse(process.env.CONFIG);
const webpack = require('webpack');
for (const rule of config.module.rules) {
if (typeof rule.test === 'string') {
rule.test = new RegExp(rule.test);
}
}
if (process.env.ANALYZE_SIZE === 'true') {
config.plugins.push(
new (require('webpack-bundle-analyzer').BundleAnalyzerPlugin)({
analyzerMode: 'static',
reportFilename: path.resolve(__dirname, '../../dist/', path.basename(config.entry) + '.html'),
}),
);
}
if (process.env.USE_VSCODE_L10N === 'true') {
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(/common\/l10n(.js)?$/, './l10n.extensionOnly.js'),
);
}
const compiler = webpack(config);
const handleResult = (err, stats) => {
if (err) {
console.error(err);
return false;
}
if (stats.hasErrors()) {
console.error(stats.toString({ colors: true }));
return false;
}
return true;
};
if (process.env.WATCH === 'true') {
compiler.watch({ aggregateTimeout: 1000 }, (err, stats) => {
handleResult(err, stats);
console.log('Bundled', path.basename(config.entry), `in ${stats.endTime - stats.startTime}ms`);
});
} else {
compiler.run((err, stats) => {
process.exit(handleResult(err, stats) ? 0 : 1);
});
}

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

@ -2,8 +2,8 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import { hash, shaHash } from '@c4312/chromehash';
import { promises as fs } from 'fs';
import { MessagePort, parentPort } from 'worker_threads';
import { readFileRaw } from '../fsUtils';
export const enum MessageType {
HashFile,
@ -112,7 +112,7 @@ async function handle(message: HashRequest): Promise<HashResponse<HashRequest>>
switch (message.type) {
case MessageType.HashFile:
try {
const data = await readFileRaw(message.file);
const data = await fs.readFile(message.file);
return {
id: message.id,
hash: message.mode === HashMode.Chromehash ? hash(data) : shaHash(data),
@ -128,7 +128,7 @@ async function handle(message: HashRequest): Promise<HashResponse<HashRequest>>
}
case MessageType.VerifyFile:
try {
const data = await readFileRaw(message.file);
const data = await fs.readFile(message.file);
return { id: message.id, matches: verifyBytes(data, message.expected, message.checkNode) };
} catch (e) {
return { id: message.id, matches: false };

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

@ -4,21 +4,34 @@
import { expect } from 'chai';
import del from 'del';
import esbuild from 'esbuild';
import { promises as fs } from 'fs';
import { join, resolve } from 'path';
import { Worker } from 'worker_threads';
import { Hasher } from '.';
import { createFileTree, getTestDir } from '../../test/createFileTree';
import { HashMode } from './hash';
const hashTestCaseDir = resolve(__dirname, '../../../../testWorkspace/hashTestCases');
const hashTestCaseDir = resolve(__dirname, '../../../testWorkspace/hashTestCases');
describe('hash process', function () {
this.timeout(15_000);
let hasher: Hasher;
let hashScript: string;
let testDir: string;
before(() => {
hasher = new Hasher();
before(async () => {
hashScript = join(hashTestCaseDir, 'hash.js');
const src = await esbuild.transform(await fs.readFile(join(__dirname, 'hash.ts')), {
loader: 'ts',
});
fs.writeFile(hashScript, src.code);
hasher = new Hasher(undefined, hashScript);
});
after(async () => {
await fs.rm(hashScript);
});
beforeEach(() => {

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

@ -20,7 +20,10 @@ export class Hasher implements IDisposable {
private readonly deferCleanup = debounce(30_000, () => this.cleanup());
constructor(private readonly maxFailures = 3) {}
constructor(
private readonly maxFailures = 3,
private readonly hasherScriptPath = join(__dirname, 'hash.js'),
) {}
/**
* Gets the Chrome content hash of script contents.
@ -75,7 +78,7 @@ export class Hasher implements IDisposable {
private send<T extends HashRequest>(req: T): Promise<HashResponse<T>> {
const cp = this.getProcess();
if (!cp) {
throw new Error('hash.bundle.js process unexpectedly exited');
throw new Error('hash.js process unexpectedly exited');
}
this.deferCleanup();
@ -106,7 +109,7 @@ export class Hasher implements IDisposable {
return undefined;
}
const instance = (this.instance = new Worker(join(__dirname, 'hash.bundle.js')));
const instance = (this.instance = new Worker(this.hasherScriptPath));
instance.setMaxListeners(Infinity);
instance.on('message', raw => {
@ -127,7 +130,7 @@ export class Hasher implements IDisposable {
if (!newInstance) {
for (const { deferred } of this.deferredMap.values()) {
deferred.reject(new Error('hash.bundle.js process unexpectedly exited'));
deferred.reject(new Error('hash.js process unexpectedly exited'));
}
this.deferredMap.clear();
this.deferCleanup.clear();

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

@ -2,6 +2,7 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import { randomBytes } from 'crypto';
import execa from 'execa';
import { tmpdir } from 'os';
import * as path from 'path';
@ -16,7 +17,10 @@ export const namedSocketDirectory = process.platform === 'win32' ? '\\\\.\\pipe\
let pipeCounter = 0;
export const getRandomPipe = () =>
path.join(namedSocketDirectory, `node-cdp.${process.pid}-${pipeCounter++}.sock`);
path.join(
namedSocketDirectory,
`node-cdp.${process.pid}-${randomBytes(4).toString('hex')}-${pipeCounter++}.sock`,
);
/*
* Lookup the given program on the PATH and return its absolute path on success and undefined otherwise.
@ -149,6 +153,10 @@ export function properRelative(fromPath: string, toPath: string): string {
}
}
const splitRe = /\/|\\/;
export const properSplit = (path: string) => path.split(splitRe);
export function fixDriveLetter(aPath: string, uppercaseDriveLetter = false): string {
if (!aPath) return aPath;

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

@ -17,8 +17,8 @@ interface IRename {
position: Base01Position;
}
/** Very approximate regex for JS identifiers, allowing member expressions as well */
const identifierRe = /[$a-z_][$0-9A-Z_$.]*/iy;
/** Very approximate regex for JS identifiers */
const identifierRe = /[$a-z_][$0-9A-Z_$]*/iy;
export interface IRenameProvider {
/**

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

@ -961,8 +961,11 @@ export function defaultSourceMapPathOverrides(webRoot: string): { [key: string]:
};
}
const applyNodeishDefaults = (
config: ResolvingNodeConfiguration | ResolvingTerminalConfiguration,
export const applyNodeishDefaults = (
config:
| ResolvingNodeConfiguration
| ResolvingTerminalConfiguration
| ResolvingExtensionHostConfiguration,
) => {
if (!config.sourceMapPathOverrides && config.cwd) {
config.sourceMapPathOverrides = defaultSourceMapPathOverrides(config.cwd);

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

@ -2,6 +2,7 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import 'reflect-metadata';
import { startDebugServer } from './debugServer';
let port = 0;

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

@ -10,7 +10,7 @@ import { SourceExplorer } from './sourceExplorer';
import { DumpContext } from './useDump';
import { usePersistedState } from './usePersistentState';
require('../../../src/diagnosticTool/diagnosticTool.css');
import './diagnosticTool.css';
declare const DUMP: IDiagnosticDump | undefined;

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

@ -4,4 +4,5 @@
import { join } from 'path';
export const toolPath = join(__dirname, 'diagnosticTool.bundle.js');
export const toolPath = join(__dirname, 'diagnosticTool.js');
export const toolStylePath = join(__dirname, 'diagnosticTool.css');

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

@ -42,7 +42,6 @@ import { BasicCpuProfiler } from './adapter/profiling/basicCpuProfiler';
import { BasicHeapProfiler } from './adapter/profiling/basicHeapProfiler';
import { HeapDumpProfiler } from './adapter/profiling/heapDumpProfiler';
import { IResourceProvider } from './adapter/resourceProvider';
import { IRequestOptionsProvider } from './adapter/resourceProvider/requestOptionsProvider';
import { ResourceProviderState } from './adapter/resourceProvider/resourceProviderState';
import { StatefulResourceProvider } from './adapter/resourceProvider/statefulResourceProvider';
import { ScriptSkipper } from './adapter/scriptSkipper/implementation';
@ -80,7 +79,6 @@ import {
SessionSubStates,
StoragePath,
trackDispose,
VSCodeApi,
} from './ioc-extras';
import { BrowserAttacher } from './targets/browser/browserAttacher';
import { ChromeLauncher } from './targets/browser/chromeLauncher';
@ -118,6 +116,7 @@ import { NullExperimentationService } from './telemetry/nullExperimentationServi
import { NullTelemetryReporter } from './telemetry/nullTelemetryReporter';
import { ITelemetryReporter } from './telemetry/telemetryReporter';
import { IShutdownParticipants, ShutdownParticipants } from './ui/shutdownParticipants';
import { registerTopLevelSessionComponents, registerUiComponents } from './ui/ui-ioc';
/**
* Contains IOC container factories for the extension. We use Inverisfy, which
@ -250,24 +249,7 @@ export const createTopLevelSessionContainer = (parent: Container) => {
container.bind(IProgramLauncher).to(TerminalProgramLauncher);
container.bind(IPackageJsonProvider).to(PackageJsonProvider).inSingletonScope();
if (parent.get(IsVSCode)) {
// dynamic require to not break the debug server
container
.bind(ILauncher)
.to(require('./targets/node/terminalNodeLauncher').TerminalNodeLauncher)
.onActivation(trackDispose);
// request options:
container
.bind(IRequestOptionsProvider)
.to(require('./ui/settingRequestOptionsProvider').SettingRequestOptionsProvider)
.inSingletonScope();
container
.bind(IExperimentationService)
.to(require('./telemetry/vscodeExperimentationService').VSCodeExperimentationService)
.inSingletonScope();
}
registerTopLevelSessionComponents(container);
container.bind(ILauncher).to(NodeAttacher).onActivation(trackDispose);
@ -338,13 +320,7 @@ export const createGlobalContainer = (options: {
container.bind(ExtensionContext).toConstantValue(options.context);
}
// Dependency that pull from the vscode global--aren't safe to require at
// a top level (e.g. in the debug server)
if (options.isVsCode) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
container.bind(VSCodeApi).toConstantValue(require('vscode'));
require('./ui/ui-ioc').registerUiComponents(container);
}
registerUiComponents(container);
return container;
};

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

@ -192,7 +192,7 @@ export class AutoAttachLauncher
await Promise.all([
copyFile(this.fs, bootloaderDefaultPath, bootloaderPath),
copyFile(this.fs, watchdogPath, path.join(storagePath, 'watchdog.bundle.js')),
copyFile(this.fs, watchdogPath, path.join(storagePath, 'watchdog.js')),
]);
const p = forceForwardSlashes(bootloaderPath);

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

@ -4,5 +4,5 @@
import { join } from 'path';
export const watchdogPath = join(__dirname, 'watchdog.bundle.js');
export const bootloaderDefaultPath = join(__dirname, 'bootloader.bundle.js');
export const watchdogPath = join(__dirname, 'watchdog.js');
export const bootloaderDefaultPath = join(__dirname, 'bootloader.js');

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

@ -37,7 +37,7 @@ export function killTree(
} else {
// on linux and OS X we kill all direct and indirect child processes as well
try {
const cmd = join(__dirname, './terminateProcess.sh');
const cmd = join(__dirname, './targets/node/terminateProcess.sh');
const r = spawnSync('sh', [
cmd,
processId.toString(),

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

@ -14,11 +14,11 @@ import {
properJoin,
properRelative,
properResolve,
properSplit,
} from '../common/pathUtils';
import { ISourceMapMetadata } from '../common/sourceMaps/sourceMap';
import { ISourcePathResolver, IUrlResolution } from '../common/sourcePathResolver';
import {
comparePathsWithoutCasing,
fileUrlToAbsolutePath,
getCaseSensitivePaths,
isAbsolute,
@ -62,14 +62,23 @@ export abstract class SourcePathResolverBase<T extends ISourcePathResolverOption
suffix = forceForwardSlashes(properResolve(suffix));
// replace special minimatch characters that appear in the local root (vscode#166400)
// we compare against the original location since forceForwardSlashes will
// prevent matching on Windows
const wf = this.options.workspaceFolder;
if (comparePathsWithoutCasing(wf, location.slice(prefix.length, prefix.length + wf.length))) {
suffix =
suffix.slice(0, wf.length).replace(/[\[\]\(\)\{\}\!\*]/g, '\\$&') + suffix.slice(wf.length);
const wfParts = properSplit(this.options.workspaceFolder);
const suffixParts = properSplit(suffix);
let sharedPrefixLen = 0;
for (
let i = 0;
i < wfParts.length &&
i < suffixParts.length &&
suffixParts[i].toLowerCase() === wfParts[i].toLowerCase();
i++
) {
sharedPrefixLen += wfParts[i].length + 1;
}
suffix =
suffix.slice(0, sharedPrefixLen).replace(/[\[\]\(\)\{\}\!\*]/g, '\\$&') +
suffix.slice(sharedPrefixLen);
return prefix + suffix;
});

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

@ -1,4 +1,5 @@
stdout> 123
stdout> {foo: 'bar'}
stdout> > {foo: 'bar'}
stdout> > arg1: {foo: 'bar'}
stdout> 1

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

@ -62,7 +62,7 @@ describe('BlazorSourcePathResolver.absolutePathToUrlRegexp', () => {
);
} else {
// This regexp was generated from running the real scenario, verifying that the breakpoint with this regexp works, and then copying it here
expect(regexp).to.equal(
expect(regexp).to.contain(
'[fF][iI][lL][eE]:\\/\\/\\/[cC]:\\/[uU][sS][eE][rR][sS]\\/[dD][iI][gG][eE][fF][fF]\\/[sS][oO][uU][rR][cC][eE]\\/' +
'[rR][eE][pP][oO][sS]\\/[mM][yY][bB][lL][aA][zZ][oO][rR][aA][pP][pP]\\/[mM][yY][bB][lL][aA][zZ][oO][rR][aA][pP][pP]\\/' +
'[pP][aA][gG][eE][sS]\\/[cC][oO][uU][nN][tT][eE][rR]\\.[rR][aA][zZ][oO][rR]($|\\?)|[cC]:\\\\[uU][sS][eE][rR][sS]\\\\[dD][iI][gG][eE][fF][fF]\\\\' +

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

@ -1,33 +1,44 @@
Evaluating: 'console.log(a0)'
stdout> (0) []
stdout> > (0) []
Evaluating: 'console.log(a1)'
stdout> (1) […]
stdout> > (1) […]
Evaluating: 'console.log(a2)'
stdout> (5) […]
stdout> > (5) […]
Evaluating: 'console.log(a3)'
stdout> (3) […, 2, 3]
stdout> > (3) […, 2, 3]
Evaluating: 'console.log(a4)'
stdout> (15) […]
stdout> > (15) […]
Evaluating: 'console.log(a5)'
stdout> (15) […, 8, …]
stdout> > (15) […, 8, …]
Evaluating: 'console.log(a6)'
stdout> (15) [0, …, 10, …]
stdout> > (15) [0, …, 10, …]
Evaluating: 'console.log(a7)'
stdout> (15) […, 4, …, index0: 0, index1: 1, index2: 2, index3: 3, index4: 4, …]
stdout> > (15) […, 4, …, index0: 0, index1: 1, index2: 2, index3: 3, index4: 4, …]
Evaluating: 'console.log(a8)'
stdout> (10) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
stdout> > (10) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Evaluating: 'console.log(a9)'
stdout> (11) […, 1, 2, 3, 4, …, 6, 7, 8, 9, …, foo: 'bar']
stdout> > (11) […, 1, 2, 3, 4, …, 6, 7, 8, 9, …, foo: 'bar']
Evaluating: 'console.log(a10)'
stdout> Array
stdout> > Array

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

@ -1,15 +0,0 @@
Evaluating: 'console.log(1n)'
stdout> 1n
Evaluating: 'console.log(BigInt(2))'
stdout> 2n
Evaluating: 'console.log([BigInt(2)])'
stdout> (1) [2n] // named=3
Evaluating: 'console.log(1n, BigInt(2))'
stdout> 1n 2n
Evaluating: 'console.log('%d %i %d %i %d %i', 123, 123, 123n, 123n, BigInt(123), BigInt(123))'
stdout> 123 123 123n 123n 123n 123n

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

@ -1,33 +1,44 @@
Evaluating: 'console.log(a0)'
stdout> (0) []
stdout> > (0) []
Evaluating: 'console.log(a1)'
stdout> (1) […]
stdout> > (1) […]
Evaluating: 'console.log(a2)'
stdout> (5) […]
stdout> > (5) […]
Evaluating: 'console.log(a3)'
stdout> (3) […, 2, 3]
stdout> > (3) […, 2, 3]
Evaluating: 'console.log(a4)'
stdout> (15) […]
stdout> > (15) […]
Evaluating: 'console.log(a5)'
stdout> (15) […, 8, …]
stdout> > (15) […, 8, …]
Evaluating: 'console.log(a6)'
stdout> (15) [0, …, 10, …]
stdout> > (15) [0, …, 10, …]
Evaluating: 'console.log(a7)'
stdout> (15) […, 4, …, index0: 0, index1: 1, index2: 2, index3: 3, index4: 4, …]
stdout> > (15) […, 4, …, index0: 0, index1: 1, index2: 2, index3: 3, index4: 4, …]
Evaluating: 'console.log(a8)'
stdout> (10) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
stdout> > (10) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Evaluating: 'console.log(a9)'
stdout> (11) […, 1, 2, 3, 4, …, 6, 7, 8, 9, …, foo: 'bar']
stdout> > (11) […, 1, 2, 3, 4, …, 6, 7, 8, 9, …, foo: 'bar']
Evaluating: 'console.log(a10)'
stdout> Array
stdout> > Array

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

@ -1,60 +1,80 @@
Evaluating: 'console.log(nodelist)'
stdout> HTMLCollection(1) [select#sel, sel: select#sel]
stdout> > HTMLCollection(1) [select#sel, sel: select#sel]
Evaluating: 'console.log([nodelist])'
stdout> (1) [HTMLCollection(1)]
stdout> > (1) [HTMLCollection(1)]
Evaluating: 'console.log(htmlcollection)'
stdout> HTMLCollection(0) []
stdout> > HTMLCollection(0) []
Evaluating: 'console.log([htmlcollection])'
stdout> (1) [HTMLCollection(0)]
stdout> > (1) [HTMLCollection(0)]
Evaluating: 'console.log(options)'
stdout> HTMLOptionsCollection(2) [option, option, selectedIndex: 0]
stdout> > HTMLOptionsCollection(2) [option, option, selectedIndex: 0]
Evaluating: 'console.log([options])'
stdout> (1) [HTMLOptionsCollection(2)]
stdout> > (1) [HTMLOptionsCollection(2)]
Evaluating: 'console.log(all)'
stdout> HTMLAllCollection(11) [html, head, body, div.c1.c2.c3, form#f, select#sel, option, option, input, input, script, f: form#f, sel: select#sel, x: HTMLCollection(2)]
stdout> > HTMLAllCollection(11) [html, head, body, div.c1.c2.c3, form#f, select#sel, option, option, input, input, script, f: form#f, sel: select#sel, x: HTMLCollection(2)]
Evaluating: 'console.log([all])'
stdout> (1) [HTMLAllCollection(11)]
stdout> > (1) [HTMLAllCollection(11)]
Evaluating: 'console.log(formControls)'
stdout> HTMLFormControlsCollection(3) [select#sel, input, input, sel: select#sel, x: RadioNodeList(2)]
stdout> > HTMLFormControlsCollection(3) [select#sel, input, input, sel: select#sel, x: RadioNodeList(2)]
Evaluating: 'console.log([formControls])'
stdout> (1) [HTMLFormControlsCollection(3)]
stdout> > (1) [HTMLFormControlsCollection(3)]
Evaluating: 'console.log(radioNodeList)'
stdout> RadioNodeList(2) [input, input, value: '']
stdout> > RadioNodeList(2) [input, input, value: '']
Evaluating: 'console.log([radioNodeList])'
stdout> (1) [RadioNodeList(2)]
stdout> > (1) [RadioNodeList(2)]
Evaluating: 'console.log(arrayX)'
stdout> (2) [1, Array(2)]
stdout> > (2) [1, Array(2)]
Evaluating: 'console.log([arrayX])'
stdout> (1) [Array(2)]
stdout> > (1) [Array(2)]
Evaluating: 'console.log(nonArray)'
stdout> NonArrayWithLength {keys: Array(0)}
stdout> > NonArrayWithLength {keys: Array(0)}
Evaluating: 'console.log([nonArray])'
stdout> (1) [NonArrayWithLength]
stdout> > (1) [NonArrayWithLength]
Evaluating: 'console.log(generateArguments(1, "2"))'
stdout> Arguments(2) [1, '2', callee: ƒ, Symbol(Symbol.iterator): ƒ]
stdout> > Arguments(2) [1, '2', callee: ƒ, Symbol(Symbol.iterator): ƒ]
Evaluating: 'console.log([generateArguments(1, "2")])'
stdout> (1) [Arguments(2)]
stdout> > (1) [Arguments(2)]
Evaluating: 'console.log(div.classList)'
stdout> DOMTokenList(3) ['c1', 'c2', 'c3', value: 'c1 c2 c3']
stdout> > DOMTokenList(3) ['c1', 'c2', 'c3', value: 'c1 c2 c3']
Evaluating: 'console.log([div.classList])'
stdout> (1) [DOMTokenList(3)]
stdout> > (1) [DOMTokenList(3)]

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

@ -1,4 +1,10 @@
Evaluating: 'try { throwError() } catch (e) { console.error(e) }'
stderr> Error
at throwError (${workspaceFolder}/web/browserify/module1.ts:6:9)
at <anonymous>:1:7 {stack: 'Error
at throwError (http://localhost:800…erify/bundle.js:23:11)
at <anonymous>:1:7'}
stderr>
> Error
at throwError (${workspaceFolder}/web/browserify/module1.ts:6:9)

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

@ -1,48 +1,64 @@
Evaluating: 'console.log(map2.keys())'
stdout> MapIterator {41, {foo: 1}}
stdout> > MapIterator {41, {foo: 1}}
Evaluating: 'console.log([map2.keys()])'
stdout> (1) [MapIterator]
stdout> > (1) [MapIterator]
Evaluating: 'console.log(map2.values())'
stdout> MapIterator {42, {foo: 2}}
stdout> > MapIterator {42, {foo: 2}}
Evaluating: 'console.log([map2.values()])'
stdout> (1) [MapIterator]
stdout> > (1) [MapIterator]
Evaluating: 'console.log(map2.entries())'
stdout> MapIterator {41 => 42, {foo: 1} => {foo: 2}}
stdout> > MapIterator {41 => 42, {foo: 1} => {foo: 2}}
Evaluating: 'console.log([map2.entries()])'
stdout> (1) [MapIterator]
stdout> > (1) [MapIterator]
Evaluating: 'console.log(set2.keys())'
stdout> SetIterator {41, {foo: 1}}
stdout> > SetIterator {41, {foo: 1}}
Evaluating: 'console.log([set2.keys()])'
stdout> (1) [SetIterator]
stdout> > (1) [SetIterator]
Evaluating: 'console.log(set2.values())'
stdout> SetIterator {41, {foo: 1}}
stdout> > SetIterator {41, {foo: 1}}
Evaluating: 'console.log([set2.values()])'
stdout> (1) [SetIterator]
stdout> > (1) [SetIterator]
Evaluating: 'console.log(set2.entries())'
stdout> SetIterator {41 => 41, {foo: 1} => {foo: 1}}
stdout> > SetIterator {41 => 41, {foo: 1} => {foo: 1}}
Evaluating: 'console.log([set2.entries()])'
stdout> (1) [SetIterator]
stdout> > (1) [SetIterator]
Evaluating: 'console.log(iter1)'
stdout> MapIterator {{foo: 2}}
stdout> > MapIterator {{foo: 2}}
Evaluating: 'console.log([iter1])'
stdout> (1) [MapIterator]
stdout> > (1) [MapIterator]
Evaluating: 'console.log(iter2)'
stdout> SetIterator {{foo: 1}}
stdout> > SetIterator {{foo: 1}}
Evaluating: 'console.log([iter2])'
stdout> (1) [SetIterator]
stdout> > (1) [SetIterator]

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

@ -1,96 +1,126 @@
Evaluating: 'console.log(p)'
stdout> Promise {[[PromiseState]]: 'rejected', [[PromiseResult]]: -0}
stdout> > Promise {[[PromiseState]]: 'rejected', [[PromiseResult]]: -0}
Evaluating: 'console.log([p])'
stdout> (1) [Promise]
stdout> > (1) [Promise]
Evaluating: 'console.log(p2)'
stdout> Promise {[[PromiseState]]: 'fulfilled', [[PromiseResult]]: 1}
stdout> > Promise {[[PromiseState]]: 'fulfilled', [[PromiseResult]]: 1}
Evaluating: 'console.log([p2])'
stdout> (1) [Promise]
stdout> > (1) [Promise]
Evaluating: 'console.log(p3)'
stdout> Promise {[[PromiseState]]: 'pending', [[PromiseResult]]: undefined}
stdout> > Promise {[[PromiseState]]: 'pending', [[PromiseResult]]: undefined}
Evaluating: 'console.log([p3])'
stdout> (1) [Promise]
stdout> > (1) [Promise]
Evaluating: 'console.log(smb1)'
stdout> Symbol()
Evaluating: 'console.log([smb1])'
stdout> (1) [Symbol()]
stdout> > (1) [Symbol()]
Evaluating: 'console.log(smb2)'
stdout> Symbol(a)
Evaluating: 'console.log([smb2])'
stdout> (1) [Symbol(a)]
stdout> > (1) [Symbol(a)]
Evaluating: 'console.log(obj)'
stdout> {getter: <accessor>, a: Symbol(), Symbol(a): 2}
stdout> > {getter: <accessor>, a: Symbol(), Symbol(a): 2}
Evaluating: 'console.log([obj])'
stdout> (1) [{…}]
stdout> > (1) [{…}]
Evaluating: 'console.log(map)'
stdout> Map(1) {size: 1, {getter: <a…r>, …} => {foo: 1}}
stdout> > Map(1) {size: 1, {getter: <a…r>, …} => {foo: 1}}
Evaluating: 'console.log([map])'
stdout> (1) [Map(1)]
stdout> > (1) [Map(1)]
Evaluating: 'console.log(weakMap)'
stdout> WeakMap {{getter: <a…r>, …} => {foo: 1}}
stdout> > WeakMap {{getter: <a…r>, …} => {foo: 1}}
Evaluating: 'console.log([weakMap])'
stdout> (1) [WeakMap]
stdout> > (1) [WeakMap]
Evaluating: 'console.log(set)'
stdout> Set(1) {size: 1, {getter: <a…r>, …}}
stdout> > Set(1) {size: 1, {getter: <a…r>, …}}
Evaluating: 'console.log([set])'
stdout> (1) [Set(1)]
stdout> > (1) [Set(1)]
Evaluating: 'console.log(weakSet)'
stdout> WeakSet {{getter: <a…r>, …}}
stdout> > WeakSet {{getter: <a…r>, …}}
Evaluating: 'console.log([weakSet])'
stdout> (1) [WeakSet]
stdout> > (1) [WeakSet]
Evaluating: 'console.log(mapMap0)'
stdout> Map(1) {size: 1, Map(0) {…} => WeakMap}
stdout> > Map(1) {size: 1, Map(0) {…} => WeakMap}
Evaluating: 'console.log([mapMap0])'
stdout> (1) [Map(1)]
stdout> > (1) [Map(1)]
Evaluating: 'console.log(mapMap)'
stdout> Map(1) {size: 1, Map(1) {…} => WeakMap {…}}
stdout> > Map(1) {size: 1, Map(1) {…} => WeakMap {…}}
Evaluating: 'console.log([mapMap])'
stdout> (1) [Map(1)]
stdout> > (1) [Map(1)]
Evaluating: 'console.log(setSet0)'
stdout> Set(1) {size: 1, WeakSet}
stdout> > Set(1) {size: 1, WeakSet}
Evaluating: 'console.log([setSet0])'
stdout> (1) [Set(1)]
stdout> > (1) [Set(1)]
Evaluating: 'console.log(setSet)'
stdout> Set(1) {size: 1, WeakSet {…}}
stdout> > Set(1) {size: 1, WeakSet {…}}
Evaluating: 'console.log([setSet])'
stdout> (1) [Set(1)]
stdout> > (1) [Set(1)]
Evaluating: 'console.log(bigmap)'
stdout> Map(6) {size: 6, from str => to str , undefined => undefined, null => null, 42 => 42, {foo: 'from'} => {foo: 'to'}, …}
stdout> > Map(6) {size: 6, from str => to str , undefined => undefined, null => null, 42 => 42, {foo: 'from'} => {foo: 'to'}, …}
Evaluating: 'console.log([bigmap])'
stdout> (1) [Map(6)]
stdout> > (1) [Map(6)]
Evaluating: 'console.log(generator)'
stdout> genFunction {[[GeneratorState]]: 'suspended'}
stdout> > genFunction {[[GeneratorState]]: 'suspended'}
Evaluating: 'console.log([generator])'
stdout> (1) [genFunction]
stdout> > (1) [genFunction]

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

@ -17,6 +17,7 @@ stdout> in named
Evaluating: 'console.group({ complex: true })'
# group: start
stdout> {complex: true}
stdout> > {complex: true}
stdout> complex: true
stdout> > [[Prototype]]: Object

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

@ -2,49 +2,72 @@ Evaluating: 'console.log(regex1)'
stdout> /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
Evaluating: 'console.log([regex1])'
stdout> (1) [/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\…?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i]
stdout> > (1) [/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\…?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i]
Evaluating: 'console.log(regex2)'
stdout> /foo\\bar\sbaz/i
Evaluating: 'console.log([regex2])'
stdout> (1) [/foo\\bar\sbaz/i]
stdout> > (1) [/foo\\bar\sbaz/i]
Evaluating: 'console.log(str)'
stdout> test
Evaluating: 'console.log([str])'
stdout> (1) ['test']
stdout> > (1) ['test']
Evaluating: 'console.log(str2)'
stdout> test named "test"
Evaluating: 'console.log([str2])'
stdout> (1) ['test named "test"']
stdout> > (1) ['test named "test"']
Evaluating: 'console.log(error)'
stdout> Error
at console-format:7:23 {stack: 'Error
at console-format:7:23'}
stdout>
> Error
at console-format:7:23 {stack: 'Error
at console-format:7:23'}
Evaluating: 'console.log([error])'
stdout> (1) [Error
at console-format:7:23]
stdout>
> (1) [Error
at console-format:7:23]
Evaluating: 'console.log(errorWithMessage)'
stdout> Error: my error message
at console-format:8:34 {stack: 'Error: my error message
at console-format:8:34', message: 'my error message'}
stdout>
> Error: my error message
at console-format:8:34 {stack: 'Error: my error message
at console-format:8:34', message: 'my error message'}
Evaluating: 'console.log([errorWithMessage])'
stdout> (1) [Error: my error message
at console-format:8:34]
stdout>
> (1) [Error: my error message
at console-format:8:34]
Evaluating: 'console.log(errorWithMultilineMessage)'
stdout> Error: my multiline
error message
at console-format:9:43 {stack: 'Error: my multiline
error message
at console-format:9:43', message: 'my multiline
error message'}
stdout>
> Error: my multiline
error message
@ -54,218 +77,284 @@ error message
error message'}
Evaluating: 'console.log([errorWithMultilineMessage])'
stdout> (1) [Error: my multiline
error message
at console-format:9:43]
stdout>
> (1) [Error: my multiline
error message
at console-format:9:43]
Evaluating: 'console.log(func)'
stdout> ƒ () { return 1; }
stdout> > ƒ () { return 1; }
Evaluating: 'console.log([func])'
stdout> (1) [ƒ]
stdout> > (1) [ƒ]
Evaluating: 'console.log(multilinefunc)'
stdout> ƒ () {
return 2;
}
stdout>
> ƒ () {
return 2;
}
Evaluating: 'console.log([multilinefunc])'
stdout> (1) [ƒ]
stdout> > (1) [ƒ]
Evaluating: 'console.log(num)'
stdout> 0.12
Evaluating: 'console.log([num])'
stdout> (1) [0.12]
stdout> > (1) [0.12]
Evaluating: 'console.log(null)'
stdout> null
Evaluating: 'console.log([null])'
stdout> (1) [null]
stdout> > (1) [null]
Evaluating: 'console.log(undefined)'
stdout> undefined
Evaluating: 'console.log([undefined])'
stdout> (1) [undefined]
stdout> > (1) [undefined]
Evaluating: 'console.log(NaN)'
stdout> NaN
Evaluating: 'console.log([NaN])'
stdout> (1) [NaN]
stdout> > (1) [NaN]
Evaluating: 'console.log(Number.POSITIVE_INFINITY)'
stdout> Infinity
Evaluating: 'console.log([Number.POSITIVE_INFINITY])'
stdout> (1) [Infinity]
stdout> > (1) [Infinity]
Evaluating: 'console.log(Number.NEGATIVE_INFINITY)'
stdout> -Infinity
Evaluating: 'console.log([Number.NEGATIVE_INFINITY])'
stdout> (1) [-Infinity]
stdout> > (1) [-Infinity]
Evaluating: 'console.log({})'
stdout> {}
stdout> > {}
Evaluating: 'console.log([{}])'
stdout> (1) [{…}]
stdout> > (1) [{…}]
Evaluating: 'console.log([function() {}])'
stdout> (1) [ƒ]
stdout> > (1) [ƒ]
Evaluating: 'console.log([[function() {}]])'
stdout> (1) [Array(1)]
stdout> > (1) [Array(1)]
Evaluating: 'console.log(objectWithNonEnumerables)'
stdout> {enumerableProp: 4, __underscoreEnumerableProp__: 5, __underscoreNonEnumerableProp: 2, abc: 3, getFoo: ƒ, …}
stdout> > {enumerableProp: 4, __underscoreEnumerableProp__: 5, __underscoreNonEnumerableProp: 2, abc: 3, getFoo: ƒ, …}
Evaluating: 'console.log([objectWithNonEnumerables])'
stdout> (1) [{…}]
stdout> > (1) [{…}]
Evaluating: 'console.log(negZero)'
stdout> -0
Evaluating: 'console.log([negZero])'
stdout> (1) [-0]
stdout> > (1) [-0]
Evaluating: 'console.log(Object.create(null))'
stdout> {}
stdout> > {}
Evaluating: 'console.log([Object.create(null)])'
stdout> (1) [{…}]
stdout> > (1) [{…}]
Evaluating: 'console.log(Object)'
stdout> ƒ Object()
stdout> > ƒ Object()
Evaluating: 'console.log([Object])'
stdout> (1) [ƒ]
stdout> > (1) [ƒ]
Evaluating: 'console.log(Object.prototype)'
stdout> {constructor: ƒ, __defineGetter__: ƒ, __defineSetter__: ƒ, hasOwnProperty: ƒ, __lookupGetter__: ƒ, …}
stdout> > {constructor: ƒ, __defineGetter__: ƒ, __defineSetter__: ƒ, hasOwnProperty: ƒ, __lookupGetter__: ƒ, …}
Evaluating: 'console.log([Object.prototype])'
stdout> (1) [{…}]
stdout> > (1) [{…}]
Evaluating: 'console.log(new Number(42))'
stdout> Number (42)
stdout> > Number (42)
Evaluating: 'console.log([new Number(42)])'
stdout> (1) [Number]
stdout> > (1) [Number]
Evaluating: 'console.log(new String("abc"))'
stdout> String ('abc')
stdout> > String ('abc')
Evaluating: 'console.log([new String("abc")])'
stdout> (1) [String]
stdout> > (1) [String]
Evaluating: 'console.log(arrayLikeFunction)'
stdout> ƒ ( /**/ foo/**/, /*/**/bar,
/**/baz) {}
stdout>
> ƒ ( /**/ foo/**/, /*/**/bar,
/**/baz) {}
Evaluating: 'console.log([arrayLikeFunction])'
stdout> (1) [ƒ]
stdout> > (1) [ƒ]
Evaluating: 'console.log(new Uint16Array(["1", "2", "3"]))'
stdout> Uint16Array(3) [1, 2, 3, buffer: ArrayBuffer(6), byteLength: 6, byteOffset: 0, length: 3, Symbol(Symbol.toStringTag): 'Uint16Array']
stdout> > Uint16Array(3) [1, 2, 3, buffer: ArrayBuffer(6), byteLength: 6, byteOffset: 0, length: 3, Symbol(Symbol.toStringTag): 'Uint16Array']
Evaluating: 'console.log([new Uint16Array(["1", "2", "3"])])'
stdout> (1) [Uint16Array(3)]
stdout> > (1) [Uint16Array(3)]
Evaluating: 'console.log(tinyTypedArray)'
stdout> Uint8Array(1) [3, buffer: ArrayBuffer(1), byteLength: 1, byteOffset: 0, length: 1, Symbol(Symbol.toStringTag): 'Uint8Array']
stdout> > Uint8Array(1) [3, buffer: ArrayBuffer(1), byteLength: 1, byteOffset: 0, length: 1, Symbol(Symbol.toStringTag): 'Uint8Array']
Evaluating: 'console.log([tinyTypedArray])'
stdout> (1) [Uint8Array(1)]
stdout> > (1) [Uint8Array(1)]
Evaluating: 'console.log(smallTypedArray)'
stdout> Uint8Array(400) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …]
stdout> > Uint8Array(400) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …]
Evaluating: 'console.log([smallTypedArray])'
stdout> (1) [Uint8Array(400)]
stdout> > (1) [Uint8Array(400)]
Evaluating: 'console.log(bigTypedArray)'
stdout> Uint8Array(400000000) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …]
stdout> > Uint8Array(400000000) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …]
Evaluating: 'console.log([bigTypedArray])'
stdout> (1) [Uint8Array(400000000)]
stdout> > (1) [Uint8Array(400000000)]
Evaluating: 'console.log(throwingLengthGetter)'
stdout> {length: <accessor>}
stdout> > {length: <accessor>}
Evaluating: 'console.log([throwingLengthGetter])'
stdout> (1) [{…}]
stdout> > (1) [{…}]
Evaluating: 'console.log(domException())'
stdout> DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. {stack: <accessor>, code: 8, name: 'NotFoundError', message: 'Failed to execute 'removeChild' on 'Node': T…e to be removed is not a child of this node.'}
stdout>
> DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. {stack: <accessor>, code: 8, name: 'NotFoundError', message: 'Failed to execute 'removeChild' on 'Node': T…e to be removed is not a child of this node.'}
Evaluating: 'console.log([domException()])'
stdout> (1) [DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of t…]
stdout> > (1) [DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of t…]
Evaluating: 'console.log(bigArray)'
stdout> (200) [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …]
stdout> > (200) [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …]
Evaluating: 'console.log([bigArray])'
stdout> (1) [Array(200)]
stdout> > (1) [Array(200)]
Evaluating: 'console.log(boxedNumberWithProps)'
stdout> Number (42)
stdout> > Number (42)
Evaluating: 'console.log([boxedNumberWithProps])'
stdout> (1) [Number]
stdout> > (1) [Number]
Evaluating: 'console.log(boxedStringWithProps)'
stdout> String ('abc')
stdout> > String ('abc')
Evaluating: 'console.log([boxedStringWithProps])'
stdout> (1) [String]
stdout> > (1) [String]
Evaluating: 'console.log(false)'
stdout> false
Evaluating: 'console.log([false])'
stdout> (1) [false]
stdout> > (1) [false]
Evaluating: 'console.log(true)'
stdout> true
Evaluating: 'console.log([true])'
stdout> (1) [true]
stdout> > (1) [true]
Evaluating: 'console.log(new Boolean(true))'
stdout> Boolean (true)
stdout> > Boolean (true)
Evaluating: 'console.log([new Boolean(true)])'
stdout> (1) [Boolean]
stdout> > (1) [Boolean]
Evaluating: 'console.log(new Set([1, 2, 3, 4]))'
stdout> Set(4) {size: 4, 1, 2, 3, 4}
stdout> > Set(4) {size: 4, 1, 2, 3, 4}
Evaluating: 'console.log([new Set([1, 2, 3, 4])])'
stdout> (1) [Set(4)]
stdout> > (1) [Set(4)]
Evaluating: 'console.log(new Set([1, 2, 3, 4, 5, 6, 7, 8]))'
stdout> Set(8) {size: 8, 1, 2, 3, 4, 5, …}
stdout> > Set(8) {size: 8, 1, 2, 3, 4, 5, …}
Evaluating: 'console.log([new Set([1, 2, 3, 4, 5, 6, 7, 8])])'
stdout> (1) [Set(8)]
stdout> > (1) [Set(8)]
Evaluating: 'console.log(new class { toString() { return "custom to string" } })'
stdout> {}
stdout> > custom to string
Evaluating: 'console.log([new class { toString() { return "custom to string" } }])'
stdout> (1) [{…}]
stdout> > (1) [{…}]
Evaluating: 'console.log(new class { toString() { return "long custom to string".repeat(500) } })'
stdout> {}
stdout> > long custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to stringlong custom to s…
Evaluating: 'console.log([new class { toString() { return "long custom to string".repeat(500) } }])'
stdout> (1) [{…}]
stdout> > (1) [{…}]

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

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

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

@ -29,49 +29,13 @@ export class GoldenText {
_hasNonAssertedLogs: boolean;
_workspaceFolder: string;
constructor(testName: string, workspaceFolder: string) {
constructor(testName: string, private readonly testFile: string, workspaceFolder: string) {
this._results = [];
this._testName = testName;
this._hasNonAssertedLogs = false;
this._workspaceFolder = urlUtils.platformPathToPreferredCase(workspaceFolder);
}
_getLocation() {
const stack = new Error().stack;
if (!stack) return null;
const stackFrames = stack.split('\n').slice(1);
// Find first stackframe that doesn't point to this file.
for (let frame of stackFrames) {
frame = frame.trim();
if (!frame.startsWith('at ')) return null;
if (frame.endsWith(')')) {
const from = frame.indexOf('(');
frame = frame.substring(from + 1, frame.length - 1);
} else {
frame = frame.substring('at '.length);
}
const match = frame.match(/^(.*):(\d+):(\d+)$/);
if (!match) return null;
const filePath = match[1];
// We need to consider .ts files because we may have source-map-support to convert stack traces to .ts
if (
filePath === __filename ||
filePath === __filename.replace(/[\\/]out([\\/].*).js$/, '$1.ts')
)
continue;
if (filePath.endsWith('.ts')) {
return filePath.replace(/([\\/]src[\\/].*).ts$/, `${path.sep}out$1.js`);
} else {
return filePath;
}
}
return null;
}
hasNonAssertedLogs() {
return this._hasNonAssertedLogs;
}
@ -126,7 +90,7 @@ export class GoldenText {
}
private findGoldenFilePath() {
const testFilePath = this._getLocation();
const testFilePath = this.testFile;
if (!testFilePath) {
throw new Error('GoldenText failed to get filename!');
}
@ -137,17 +101,7 @@ export class GoldenText {
.replace(/\s/g, '-')
.replace(/[^-0-9a-zа-яё]/gi, '');
const testFileBase = path.resolve(
__dirname,
'..',
'..',
'..',
'src',
'test',
path.relative(__dirname, path.dirname(testFilePath)),
fileFriendlyTestName,
);
const testFileBase = path.resolve(path.dirname(testFilePath), fileFriendlyTestName);
const platformPath = testFileBase + `.${process.platform}.txt`;
if (fs.existsSync(platformPath)) {
return platformPath;

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

@ -50,6 +50,7 @@ describe('node runtime', () => {
}
describe('skipFiles', () => {
console.log('described skipFiles');
itIntegrates('skipFiles skip node internals', async ({ r }) => {
await r.initialize;
const cwd = join(testWorkspace, 'simpleNode');
@ -152,11 +153,13 @@ describe('node runtime', () => {
if (process.env.ONLY_MINSPEC !== 'true') {
// not available on node 8
itIntegrates('debugs worker threads', async ({ r }) => {
// note: __filename is broken up in the below script to
// avoid the esbuild plugin that replaces them in tests 🙈
createFileTree(testFixturesDir, {
'test.js': [
'const { Worker, isMainThread, workerData } = require("worker_threads");',
'if (isMainThread) {',
' new Worker(__filename, { workerData: { greet: "world" } });',
' new Worker(__f' + 'ilename, { workerData: { greet: "world" } });',
'} else {',
' setInterval(() => {',
' console.log("hello " + workerData.greet);',
@ -366,7 +369,7 @@ describe('node runtime', () => {
createFileTree(testFixturesDir, {
'test.js': `
const { spawn } = require('child_process');
setInterval(() => spawn('node', ['child'], { cwd: __dirname }), 500);
setInterval(() => spawn('node', ['child'], { cwd: __dir${''}name }), 500);
`,
'child.js': '(function foo() { debugger; })();',
});
@ -456,7 +459,7 @@ describe('node runtime', () => {
'test.js': `
const cp = require('child_process');
const path = require('path');
cp.fork(path.join(__dirname, 'child.js'));
cp.fork(path.join(__dir${''}name, 'child.js'));
`,
'child.js': `
const foo = 'It works!';

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

@ -7,6 +7,7 @@ import { promises as fsPromises } from 'fs';
import { join, resolve } from 'path';
import { LocalFsUtils } from '../../common/fsUtils';
import { Logger } from '../../common/logging/logger';
import { fixDriveLetter } from '../../common/pathUtils';
import { resetCaseSensitivePaths, setCaseSensitivePaths } from '../../common/urlUtils';
import { NodeSourcePathResolver } from '../../targets/node/nodeSourcePathResolver';
@ -30,6 +31,60 @@ describe('node source path resolver', () => {
);
});
it('escapes regex parts segments', async () => {
if (process.platform === 'win32') {
const r = new NodeSourcePathResolver(
fsUtils,
undefined,
{
...defaultOptions,
workspaceFolder: 'C:\\some\\workspa*ce\\folder',
basePath: 'C:\\some\\workspa*ce\\folder',
resolveSourceMapLocations: [
'C:\\some\\workspa*ce\\folder/**',
'C:\\some\\workspa*ce\\folder/../**',
'C:\\some\\workspa*ce\\folder/../foo/**',
],
},
await Logger.test(),
);
expect((r as unknown as Record<string, string[]>).resolvePatterns).to.deep.equal([
'C:/some/workspa\\*ce/folder/**',
'C:/some/workspa\\*ce/**',
'C:/some/workspa\\*ce/foo/**',
]);
}
});
it('fixes regex escape issue #1554', async () => {
if (process.platform === 'win32') {
const r = new NodeSourcePathResolver(
fsUtils,
undefined,
{
...defaultOptions,
workspaceFolder: 'C:\\Users\\Segev\\prj\\swimm\\ide\\extensions\\vscode',
basePath: 'C:\\Users\\Segev\\prj\\swimm\\ide\\extensions\\vscode',
resolveSourceMapLocations: [
'C:\\Users\\Segev\\prj\\swimm\\ide\\extensions\\vscode/**',
'C:\\Users\\Segev\\prj\\swimm\\ide\\extensions\\vscode/../../../packages/shared/dist/**',
'C:\\Users\\Segev\\prj\\swimm\\ide\\extensions\\vscode/../../../packages/swimmagic/dist/**',
'C:\\Users\\Segev\\prj\\swimm\\ide\\extensions\\vscode/../../../packages/editor/dist/**',
'C:\\Users\\Segev\\prj\\swimm\\ide\\extensions\\vscode/../../server/dist/**',
'!**/node_modules/**',
],
},
await Logger.test(),
);
expect(
r.shouldResolveSourceMap({
compiledPath: 'c:\\Users\\Segev\\prj\\swimm\\ide\\server\\dist\\app.js',
sourceMapUrl: 'file:///c:/Users/Segev/prj/swimm/ide/server/dist/app.js.map',
}),
).to.be.true;
}
});
it('resolves unc paths', async () => {
if (process.platform !== 'win32') {
return;
@ -93,7 +148,7 @@ describe('node source path resolver', () => {
url: 'webpack:///hello.js',
map: { sourceRoot: '', metadata: { compiledPath: 'hello.js' } } as any,
}),
).to.equal(join(__dirname, 'hello.js'));
).to.equal(fixDriveLetter(join(__dirname, 'hello.js')));
});
it('loads local node internals (#823)', async () => {
@ -174,7 +229,9 @@ describe('node source path resolver', () => {
});
if (ok) {
expect(result).to.equal(join(__dirname, 'hello.js'));
expect(result && fixDriveLetter(result)).to.equal(
fixDriveLetter(join(__dirname, 'hello.js')),
);
} else {
expect(result).to.be.undefined;
}

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

@ -2,33 +2,30 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import { runTests } from '@vscode/test-electron';
import minimist from 'minimist';
import * as path from 'path';
const { runTests } = require('@vscode/test-electron');
const minimist = require('minimist');
const path = require('path');
async function main() {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, '..' + path.sep + '..' + path.sep);
const extensionDevelopmentPath = path.resolve(__dirname, '../../dist');
// The path to the extension test script
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, '.' + path.sep + 'testRunner');
const extensionTestsPath = path.resolve(extensionDevelopmentPath, 'src/testRunner');
process.env.PWA_TEST_OPTIONS = JSON.stringify(minimist(process.argv.slice(2)));
// Download VS Code, unzip it and run the integration test
const basedir = path.resolve(__dirname, '../../..');
const basedir = path.resolve(__dirname, '../..');
await runTests({
extensionDevelopmentPath,
extensionTestsPath,
// temporarily disabled for test failure:
// version: 'insiders',
launchArgs: [
basedir,
`--extensions-dir=${path.resolve(basedir, 'node_modules/.code-extensions')}`,
'--disable-extension=ms-vscode.js-debug',
'--disable-user-env-probe',
'--disable-workspace-trust',

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

@ -41,7 +41,7 @@ import { getLogFileForTest } from './reporters/logReporterUtils';
export const kStabilizeNames = ['id', 'threadId', 'sourceReference', 'variablesReference'];
export const workspaceFolder = path.join(__dirname, '..', '..', '..');
export const workspaceFolder = path.join(__dirname, '..', '..');
export const testWorkspace = path.join(workspaceFolder, 'testWorkspace');
export const testSources = path.join(workspaceFolder, 'src');
export const testFixturesDirName = '.dynamic-testWorkspace';
@ -345,9 +345,7 @@ export class TestRoot {
this._args = ['--headless'];
this.log = goldenText.log.bind(goldenText);
this.assertLog = goldenText.assertLog.bind(goldenText);
this._workspaceRoot = utils.platformPathToPreferredCase(
path.join(__dirname, '..', '..', '..', 'testWorkspace'),
);
this._workspaceRoot = utils.platformPathToPreferredCase(testWorkspace);
this._webRoot = path.join(this._workspaceRoot, 'web');
const storagePath = path.join(__dirname, '..', '..');

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

@ -6,11 +6,11 @@ import * as child_process from 'child_process';
import del from 'del';
import { ExclusiveTestFunction, TestFunction } from 'mocha';
import * as path from 'path';
import { GoldenText } from './goldenText';
import { testFixturesDir, TestRoot, testWorkspace, ITestHandle } from './test';
import { forceForwardSlashes } from '../common/pathUtils';
import { IGoldenReporterTextTest } from './reporters/goldenTextReporterUtils';
import { delay } from '../common/promiseUtil';
import { GoldenText } from './goldenText';
import { IGoldenReporterTextTest } from './reporters/goldenTextReporterUtils';
import { ITestHandle, testFixturesDir, TestRoot, testWorkspace } from './test';
process.env['DA_TEST_DISABLE_TELEMETRY'] = 'true';
@ -53,7 +53,15 @@ const itIntegratesBasic = (
testFunction: TestFunction | ExclusiveTestFunction = it,
) =>
testFunction(test, async function () {
const golden = new GoldenText(this.test!.titlePath().join(' '), testWorkspace);
if (!this.test?.file) {
throw new Error(`Could not find file for test`);
}
const golden = new GoldenText(
this.test!.titlePath().join(' '),
this.test?.file!,
testWorkspace,
);
const root = new TestRoot(golden, this.test!.fullTitle());
await root.initialize;

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

@ -2,9 +2,11 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import * as glob from 'glob';
//@ts-ignore
import allTests from '**/*.test.ts';
import Mocha from 'mocha';
import { join } from 'path';
import LoggingReporter from './reporters/logTestReporter';
import './testHooks';
function setupCoverage() {
@ -44,20 +46,10 @@ export async function run(): Promise<void> {
mochaOpts.grep = new RegExp(String(grep), 'i');
}
// Paths are relative to Mocha
const logTestReporter = '../../../out/src/test/reporters/logTestReporter';
// const goldenTextReporter =
// '../../../out/src/test/reporters/goldenTextReporter';
mochaOpts.reporter = 'mocha-multi-reporters';
mochaOpts.reporterOptions = {
// reporterEnabled: `${logTestReporter}, ${goldenTextReporter}`,
// reporterEnabled: goldenTextReporter
reporterEnabled: logTestReporter,
};
mochaOpts.reporter = LoggingReporter;
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
mochaOpts.reporterOptions = {
reporterEnabled: `${logTestReporter}, mocha-junit-reporter`,
reporterEnabled: `mocha-junit-reporter`,
mochaJunitReporterReporterOptions: {
testsuitesTitle: `tests ${process.platform}`,
mochaFile: join(
@ -69,39 +61,43 @@ export async function run(): Promise<void> {
}
const runner = new Mocha(mochaOpts);
const addFile = async (file: string, doImport: () => Promise<unknown>) => {
runner.suite.emit(Mocha.Suite.constants.EVENT_FILE_PRE_REQUIRE, globalThis, file, runner);
const m = await doImport();
runner.suite.emit(Mocha.Suite.constants.EVENT_FILE_REQUIRE, m, file, runner);
runner.suite.emit(Mocha.Suite.constants.EVENT_FILE_POST_REQUIRE, globalThis, file, runner);
};
// todo: retry failing tests https://github.com/microsoft/vscode-pwa/issues/28
if (process.env.RETRY_TESTS) {
runner.retries(Number(process.env.RETRY_TESTS));
}
const rel = (f: string) => join(__dirname, `${f}.ts`);
if (process.env.FRAMEWORK_TESTS) {
runner.addFile(join(__dirname, 'framework/reactTest'));
await addFile(rel('framework/reactTest'), () => import('./framework/reactTest'));
} else {
runner.addFile(join(__dirname, 'testIntegrationUtils'));
runner.addFile(join(__dirname, 'infra/infra'));
runner.addFile(join(__dirname, 'breakpoints/breakpointsTest'));
runner.addFile(join(__dirname, 'browser/framesTest'));
runner.addFile(join(__dirname, 'browser/blazorSourcePathResolverTest'));
runner.addFile(join(__dirname, 'evaluate/evaluate'));
runner.addFile(join(__dirname, 'sources/sourcesTest'));
runner.addFile(join(__dirname, 'stacks/stacksTest'));
runner.addFile(join(__dirname, 'threads/threadsTest'));
runner.addFile(join(__dirname, 'variables/variablesTest'));
runner.addFile(join(__dirname, 'console/consoleFormatTest'));
runner.addFile(join(__dirname, 'console/consoleAPITest'));
await addFile(rel('testIntegrationUtils'), () => import('./testIntegrationUtils'));
await addFile(rel('infra/infra'), () => import('./infra/infra'));
await addFile(
rel('breakpoints/breakpointsTest'),
() => import('./breakpoints/breakpointsTest'),
);
await addFile(rel('browser/framesTest'), () => import('./browser/framesTest'));
await addFile(
rel('browser/blazorSourcePathResolverTest'),
() => import('./browser/blazorSourcePathResolverTest'),
);
await addFile(rel('evaluate/evaluate'), () => import('./evaluate/evaluate'));
await addFile(rel('sources/sourcesTest'), () => import('./sources/sourcesTest'));
await addFile(rel('stacks/stacksTest'), () => import('./stacks/stacksTest'));
await addFile(rel('threads/threadsTest'), () => import('./threads/threadsTest'));
await addFile(rel('variables/variablesTest'), () => import('./variables/variablesTest'));
await addFile(rel('console/consoleFormatTest'), () => import('./console/consoleFormatTest'));
await addFile(rel('console/consoleAPITest'), () => import('./console/consoleAPITest'));
const options = { cwd: __dirname };
const files = glob.sync('**/*.test.js', options);
// Only run tests on supported platforms
// https://nodejs.org/api/process.html#process_process_platform
if (process.platform === 'win32') {
files.push(...glob.sync('**/*.test.win.js', options));
}
for (const file of files) {
runner.addFile(join(__dirname, file));
for (const [path, imp] of allTests) {
await addFile(rel(path), imp);
}
}

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

@ -2,12 +2,14 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import express from 'express';
import * as path from 'path';
//@ts-check
const express = require('express');
const path = require('path');
const port = +process.argv[2];
const app = express();
const webRoot = path.join(__dirname, '..', '..', '..', 'testWorkspace', 'web');
const webRoot = path.join(__dirname, '..', '..', 'testWorkspace', 'web');
app.get('/cookies/home', (req, res) => {
res.header('Set-Cookie', 'authed=true');
res.sendFile(path.join(webRoot, 'browserify/pause.html'));
@ -51,5 +53,5 @@ app.get('/greet', (_req, res) => res.send('Hello world!'));
app.use('/', express.static(path.join(webRoot)));
app.listen(port, () => {
process.send!('ready');
process.send('ready');
});

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

@ -1,3 +1,4 @@
stderr> {foo: {…}}
stderr> > {foo: {…}}
stderr> > arg0: {foo: {…}}
stderr>
@ -6,12 +7,14 @@ stderr>
<anonymous> @ ${workspaceFolder}/web/worker.js:10:5
◀ Worker.postMessage ▶
<anonymous> @ ${workspaceFolder}/web/worker.html:8:10
stderr> {foo: {…}}
stderr> > {foo: {…}}
stderr> > arg0: {foo: {…}}
stderr>
<anonymous> @ ${workspaceFolder}/web/worker.js:1:9
◀ Worker Created ▶
<anonymous> @ ${workspaceFolder}/web/worker.html:2:12
stderr> {foo: {…}}
stderr> > {foo: {…}}
stderr> > arg0: {foo: {…}}
stderr>

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

@ -1,6 +1,6 @@
hitDebugger @ ${workspaceFolder}/web/minified/index.js:13:5
> scope #0: Local: hitDebugger
c @ ${workspaceFolder}/web/minified/index.js:13:5
> scope #0: Local: c
arg1: 2
arg2: 3
> this: Window
@ -12,13 +12,15 @@ test @ ${workspaceFolder}/web/minified/index.js:6:5
inner2: 3
> this: Window
> scope #1: Local: test
> hitDebugger: ƒ hitDebugger(arg1, arg2) {
debugger;
}
later: undefined
outer: 1
> hitDebugger: ƒ c(n,t){debugger}
inner1: 1
inner2: undefined
scope #2: Global [expensive]
<anonymous> @ <eval>/VM<xx>:1:1
scope #0: Global [expensive]
Preserves eval sourceURL (#1259):
Uncaught ReferenceError ReferenceError: thenSomethingInvalid is not defined
at eval (repl:2:1)

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

@ -365,8 +365,19 @@ describe('variables', () => {
const p = await r.launchUrlAndLoad('minified/index.html');
p.cdp.Runtime.evaluate({ expression: `test()` });
const event = await p.dap.once('stopped');
await p.logger.logStackTrace(event.threadId!, true);
const stacks = await p.logger.logStackTrace(event.threadId!, true);
p.log('\nPreserves eval sourceURL (#1259):'); // https://github.com/microsoft/vscode-js-debug/issues/1259#issuecomment-1442584596
p.log(
await p.dap.evaluate({
expression: 'arg1; thenSomethingInvalid()',
context: 'repl',
frameId: stacks[0].id,
}),
);
await p.dap.continue({ threadId: event.threadId! });
p.assertLog();
});

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

@ -8,6 +8,7 @@ import { join } from 'path';
import * as vscode from 'vscode';
import { DebugType } from '../../common/contributionUtils';
import {
applyNodeishDefaults,
extensionHostConfigDefaults,
IExtensionHostLaunchConfiguration,
resolveVariableInConfig,
@ -39,6 +40,8 @@ export class ExtensionHostConfigurationResolver
config.outFiles = []; // will have a runtime script offset which invalidates any predictions
}
applyNodeishDefaults(config);
return Promise.resolve({
...extensionHostConfigDefaults,
...config,

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

@ -116,6 +116,13 @@ export async function findScripts(
)
).flat();
if (candidates.length === 0) {
if (!silent) {
vscode.window.showErrorMessage(l10n.t('No package.json files found in your workspace.'));
}
return;
}
const scripts: IScript[] = [];
// editCandidate is the file we'll edit if we don't find any npm scripts.

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

@ -0,0 +1,93 @@
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import { Container } from 'inversify';
import { IRequestOptionsProvider } from '../adapter/resourceProvider/requestOptionsProvider';
import { IExtensionContribution, trackDispose, VSCodeApi } from '../ioc-extras';
import { TerminalNodeLauncher } from '../targets/node/terminalNodeLauncher';
import { ILauncher } from '../targets/targets';
import { IExperimentationService } from '../telemetry/experimentationService';
import { VSCodeExperimentationService } from '../telemetry/vscodeExperimentationService';
import { CascadeTerminationTracker } from './cascadeTerminateTracker';
import {
allConfigurationProviders,
allConfigurationResolvers,
IDebugConfigurationProvider,
IDebugConfigurationResolver,
} from './configuration';
import { DebugLinkUi } from './debugLinkUI';
import { DebugSessionTracker } from './debugSessionTracker';
import { DiagnosticsUI } from './diagnosticsUI';
import { DisableSourceMapUI } from './disableSourceMapUI';
import { EdgeDevToolOpener } from './edgeDevToolOpener';
import { ExcludedCallersUI } from './excludedCallersUI';
import { ILinkedBreakpointLocation } from './linkedBreakpointLocation';
import { LinkedBreakpointLocationUI } from './linkedBreakpointLocationUI';
import { LongPredictionUI } from './longPredictionUI';
import { JsDebugPortAttributesProvider } from './portAttributesProvider';
import { PrettyPrintUI } from './prettyPrint';
import { BreakpointTerminationConditionFactory } from './profiling/breakpointTerminationCondition';
import { DurationTerminationConditionFactory } from './profiling/durationTerminationCondition';
import { ManualTerminationConditionFactory } from './profiling/manualTerminationCondition';
import { ITerminationConditionFactory } from './profiling/terminationCondition';
import { UiProfileManager } from './profiling/uiProfileManager';
import { SettingRequestOptionsProvider } from './settingRequestOptionsProvider';
import { SourceSteppingUI } from './sourceSteppingUI';
import { StartDebugingAndStopOnEntry } from './startDebuggingAndStopOnEntry';
import { TerminalLinkHandler } from './terminalLinkHandler';
export const registerUiComponents = (container: Container) => {
container.bind(VSCodeApi).toConstantValue(require('vscode'));
allConfigurationResolvers.forEach(cls => {
container
.bind(cls as { new (...args: unknown[]): unknown })
.toSelf()
.inSingletonScope();
container.bind(IDebugConfigurationResolver).to(cls);
});
allConfigurationProviders.forEach(cls =>
container.bind(IDebugConfigurationProvider).to(cls).inSingletonScope(),
);
container.bind(IExtensionContribution).to(LongPredictionUI).inSingletonScope();
container.bind(IExtensionContribution).to(DebugLinkUi).inSingletonScope();
container.bind(IExtensionContribution).to(CascadeTerminationTracker).inSingletonScope();
container.bind(IExtensionContribution).to(DisableSourceMapUI).inSingletonScope();
container.bind(IExtensionContribution).to(DiagnosticsUI).inSingletonScope();
container.bind(IExtensionContribution).to(StartDebugingAndStopOnEntry).inSingletonScope();
container.bind(IExtensionContribution).to(JsDebugPortAttributesProvider).inSingletonScope();
container.bind(IExtensionContribution).to(EdgeDevToolOpener).inSingletonScope();
container.bind(IExtensionContribution).to(ExcludedCallersUI).inSingletonScope();
container.bind(IExtensionContribution).to(PrettyPrintUI).inSingletonScope();
container.bind(IExtensionContribution).to(SourceSteppingUI).inSingletonScope();
container.bind(ILinkedBreakpointLocation).to(LinkedBreakpointLocationUI).inSingletonScope();
container.bind(DebugSessionTracker).toSelf().inSingletonScope().onActivation(trackDispose);
container.bind(UiProfileManager).toSelf().inSingletonScope().onActivation(trackDispose);
container.bind(TerminalLinkHandler).toSelf().inSingletonScope();
container.bind(DisableSourceMapUI).toSelf().inSingletonScope();
container
.bind(ITerminationConditionFactory)
.to(DurationTerminationConditionFactory)
.inSingletonScope();
container
.bind(ITerminationConditionFactory)
.to(ManualTerminationConditionFactory)
.inSingletonScope();
container
.bind(ITerminationConditionFactory)
.to(BreakpointTerminationConditionFactory)
.inSingletonScope();
};
export const registerTopLevelSessionComponents = (container: Container) => {
container.bind(ILauncher).to(TerminalNodeLauncher).onActivation(trackDispose);
// request options:
container.bind(IRequestOptionsProvider).to(SettingRequestOptionsProvider).inSingletonScope();
container.bind(IExperimentationService).to(VSCodeExperimentationService).inSingletonScope();
};

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

@ -3,74 +3,11 @@
*--------------------------------------------------------*/
import { Container } from 'inversify';
import { IExtensionContribution, trackDispose } from '../ioc-extras';
import { CascadeTerminationTracker } from './cascadeTerminateTracker';
import {
allConfigurationProviders,
allConfigurationResolvers,
IDebugConfigurationProvider,
IDebugConfigurationResolver,
} from './configuration';
import { DebugLinkUi } from './debugLinkUI';
import { DebugSessionTracker } from './debugSessionTracker';
import { DiagnosticsUI } from './diagnosticsUI';
import { DisableSourceMapUI } from './disableSourceMapUI';
import { EdgeDevToolOpener } from './edgeDevToolOpener';
import { ExcludedCallersUI } from './excludedCallersUI';
import { ILinkedBreakpointLocation } from './linkedBreakpointLocation';
import { LinkedBreakpointLocationUI } from './linkedBreakpointLocationUI';
import { LongPredictionUI } from './longPredictionUI';
import { JsDebugPortAttributesProvider } from './portAttributesProvider';
import { PrettyPrintUI } from './prettyPrint';
import { BreakpointTerminationConditionFactory } from './profiling/breakpointTerminationCondition';
import { DurationTerminationConditionFactory } from './profiling/durationTerminationCondition';
import { ManualTerminationConditionFactory } from './profiling/manualTerminationCondition';
import { ITerminationConditionFactory } from './profiling/terminationCondition';
import { UiProfileManager } from './profiling/uiProfileManager';
import { SourceSteppingUI } from './sourceSteppingUI';
import { StartDebugingAndStopOnEntry } from './startDebuggingAndStopOnEntry';
import { TerminalLinkHandler } from './terminalLinkHandler';
export const registerUiComponents = (container: Container) => {
allConfigurationResolvers.forEach(cls => {
container
.bind(cls as { new (...args: unknown[]): unknown })
.toSelf()
.inSingletonScope();
container.bind(IDebugConfigurationResolver).to(cls);
});
allConfigurationProviders.forEach(cls =>
container.bind(IDebugConfigurationProvider).to(cls).inSingletonScope(),
);
container.bind(IExtensionContribution).to(LongPredictionUI).inSingletonScope();
container.bind(IExtensionContribution).to(DebugLinkUi).inSingletonScope();
container.bind(IExtensionContribution).to(CascadeTerminationTracker).inSingletonScope();
container.bind(IExtensionContribution).to(DisableSourceMapUI).inSingletonScope();
container.bind(IExtensionContribution).to(DiagnosticsUI).inSingletonScope();
container.bind(IExtensionContribution).to(StartDebugingAndStopOnEntry).inSingletonScope();
container.bind(IExtensionContribution).to(JsDebugPortAttributesProvider).inSingletonScope();
container.bind(IExtensionContribution).to(EdgeDevToolOpener).inSingletonScope();
container.bind(IExtensionContribution).to(ExcludedCallersUI).inSingletonScope();
container.bind(IExtensionContribution).to(PrettyPrintUI).inSingletonScope();
container.bind(IExtensionContribution).to(SourceSteppingUI).inSingletonScope();
container.bind(ILinkedBreakpointLocation).to(LinkedBreakpointLocationUI).inSingletonScope();
container.bind(DebugSessionTracker).toSelf().inSingletonScope().onActivation(trackDispose);
container.bind(UiProfileManager).toSelf().inSingletonScope().onActivation(trackDispose);
container.bind(TerminalLinkHandler).toSelf().inSingletonScope();
container.bind(DisableSourceMapUI).toSelf().inSingletonScope();
container
.bind(ITerminationConditionFactory)
.to(DurationTerminationConditionFactory)
.inSingletonScope();
container
.bind(ITerminationConditionFactory)
.to(ManualTerminationConditionFactory)
.inSingletonScope();
container
.bind(ITerminationConditionFactory)
.to(BreakpointTerminationConditionFactory)
.inSingletonScope();
export const registerUiComponents = (_container: Container) => {
// no-op function that's loaded in standalone debug servers
};
export const registerTopLevelSessionComponents = (_container: Container) => {
// no-op function that's loaded in standalone debug servers
};

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

@ -1,5 +1,5 @@
<head>
<script src='index.js'></script>
<script src='index.min.js'></script>
</head>
<body>
</body>

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

@ -7,7 +7,7 @@
"noImplicitAny": true,
"noImplicitThis": true,
"sourceMap": true,
"outDir": "./out/src",
"noEmit": true,
"strict": true,
"useUnknownInCatchVariables": false,
"noUnusedLocals": true,