chore: fix tests, partly
This commit is contained in:
Родитель
a2aa77be53
Коммит
8c33902236
|
@ -6,7 +6,7 @@ jobs:
|
|||
- job: nightly_release
|
||||
displayName: Nightly Release
|
||||
variables:
|
||||
node_version: 12.13.0
|
||||
node_version: 14.18.3
|
||||
pool:
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
|
|
|
@ -10,7 +10,7 @@ jobs:
|
|||
steps:
|
||||
- template: common-validation.yml
|
||||
variables:
|
||||
node_version: 12.13.0
|
||||
node_version: 14.18.3
|
||||
|
||||
- job: Linux
|
||||
pool:
|
||||
|
@ -18,7 +18,7 @@ jobs:
|
|||
steps:
|
||||
- template: common-validation.yml
|
||||
variables:
|
||||
node_version: 12.13.0
|
||||
node_version: 14.18.3
|
||||
|
||||
- job: LinuxMinspec
|
||||
pool:
|
||||
|
@ -26,7 +26,7 @@ jobs:
|
|||
steps:
|
||||
- template: common-validation.yml
|
||||
variables:
|
||||
node_version: 12.13.0
|
||||
node_version: 14.18.3
|
||||
only_minspec: true
|
||||
|
||||
- job: Windows
|
||||
|
@ -45,4 +45,4 @@ jobs:
|
|||
displayName: Install Edge Canary
|
||||
- template: common-validation.yml
|
||||
variables:
|
||||
node_version: 12.13.0
|
||||
node_version: 14.18.3
|
||||
|
|
|
@ -7,7 +7,7 @@ jobs:
|
|||
pool:
|
||||
vmImage: 'macOS-10.15'
|
||||
variables:
|
||||
node_version: 12.13.0
|
||||
node_version: 14.18.3
|
||||
steps:
|
||||
- template: common-validation.yml
|
||||
parameters:
|
||||
|
@ -18,7 +18,7 @@ jobs:
|
|||
pool:
|
||||
vmImage: 'ubuntu-18.04'
|
||||
variables:
|
||||
node_version: 12.13.0
|
||||
node_version: 14.18.3
|
||||
steps:
|
||||
- template: common-validation.yml
|
||||
parameters:
|
||||
|
|
|
@ -9,7 +9,7 @@ jobs:
|
|||
- job: stable_release
|
||||
displayName: Stable Release
|
||||
variables:
|
||||
node_version: 12.13.0
|
||||
node_version: 14.18.3
|
||||
pool:
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
|
|
|
@ -60,7 +60,8 @@
|
|||
],
|
||||
"args": [
|
||||
"--enable-proposed-api=ms-vscode.js-debug",
|
||||
"--extensionDevelopmentPath=${workspaceFolder}/out"
|
||||
"--extensionDevelopmentPath=${workspaceFolder}/out",
|
||||
"--extensionDevelopmentPath=${workspaceFolder}/../vscode-hexeditor",
|
||||
],
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/out/**/*.js",
|
||||
|
|
|
@ -36,7 +36,7 @@ export class MultiMap<T, K extends { [key: string]: unknown }> {
|
|||
public delete(value: T) {
|
||||
for (const [name, keyFn] of this.keygenPairs) {
|
||||
const key = keyFn(value) as any;
|
||||
if (key === this.maps[name].get(key)) {
|
||||
if (value === this.maps[name].get(key)) {
|
||||
this.maps[name].delete(key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ export class NvmResolver implements INvmResolver {
|
|||
private readonly env = process.env,
|
||||
private readonly arch = process.arch,
|
||||
private readonly platform = process.platform,
|
||||
private readonly homedir = os.homedir(),
|
||||
) {}
|
||||
|
||||
public async resolveNvmVersionPath(version: string) {
|
||||
|
@ -78,7 +79,7 @@ export class NvmResolver implements INvmResolver {
|
|||
versionManagers.push('nvm-windows');
|
||||
}
|
||||
} else {
|
||||
const nvmDir = this.env[Vars.UnixNvmHome] || path.join(os.homedir(), '.nvm');
|
||||
const nvmDir = this.env[Vars.UnixNvmHome] || path.join(this.homedir, '.nvm');
|
||||
if (await this.fsUtils.exists(nvmDir)) {
|
||||
directory = await this.resolveUnixNvm(version);
|
||||
versionManagers.push('nvm');
|
||||
|
|
|
@ -322,7 +322,11 @@ describe('NodeDebugConfigurationProvider', () => {
|
|||
program: 'hello.js',
|
||||
});
|
||||
|
||||
expect(result?.outFiles).to.deep.equal(['${workspaceFolder}/**/*.js', '!**/node_modules/**']);
|
||||
expect(result?.outFiles).to.deep.equal([
|
||||
'${workspaceFolder}/../**/*.js',
|
||||
'!**/node_modules/**',
|
||||
'!${workspaceFolder}/../**/node_modules/**',
|
||||
]);
|
||||
});
|
||||
|
||||
it('preserves outFiles if package.json is in the same folder', async () => {
|
||||
|
@ -338,7 +342,11 @@ describe('NodeDebugConfigurationProvider', () => {
|
|||
program: 'hello.js',
|
||||
});
|
||||
|
||||
expect(result?.outFiles).to.deep.equal(['${workspaceFolder}/**/*.js', '!**/node_modules/**']);
|
||||
expect(result?.outFiles).to.deep.equal([
|
||||
'${workspaceFolder}/**/*.js',
|
||||
'!**/node_modules/**',
|
||||
'!${workspaceFolder}/**/node_modules/**',
|
||||
]);
|
||||
});
|
||||
|
||||
it('gets the nearest nested package.json', async () => {
|
||||
|
@ -358,6 +366,8 @@ describe('NodeDebugConfigurationProvider', () => {
|
|||
expect(result?.outFiles).to.deep.equal([
|
||||
'${workspaceFolder}/a/b/**/*.js',
|
||||
'!**/node_modules/**',
|
||||
,
|
||||
'!${workspaceFolder}/a/b/**/node_modules/**',
|
||||
]);
|
||||
});
|
||||
|
||||
|
@ -378,6 +388,7 @@ describe('NodeDebugConfigurationProvider', () => {
|
|||
expect(result?.outFiles).to.deep.equal([
|
||||
'${workspaceFolder}/a/**/*.js',
|
||||
'!**/node_modules/**',
|
||||
'!${workspaceFolder}/a/**/node_modules/**',
|
||||
]);
|
||||
});
|
||||
|
||||
|
@ -401,7 +412,11 @@ describe('NodeDebugConfigurationProvider', () => {
|
|||
},
|
||||
);
|
||||
|
||||
expect(result?.outFiles).to.deep.equal(['${workspaceFolder}/**/*.js', '!**/node_modules/**']);
|
||||
expect(result?.outFiles).to.deep.equal([
|
||||
'${workspaceFolder}/../**/*.js',
|
||||
'!**/node_modules/**',
|
||||
'!${workspaceFolder}/../**/node_modules/**',
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
supportsLoadedSourcesRequest : true
|
||||
supportsLogPoints : true
|
||||
supportsModulesRequest : false
|
||||
supportsReadMemoryRequest : true
|
||||
supportsRestartFrame : true
|
||||
supportsRestartRequest : true
|
||||
supportsSetExpression : true
|
||||
|
@ -53,4 +54,5 @@
|
|||
supportsTerminateRequest : false
|
||||
supportsTerminateThreadsRequest : false
|
||||
supportsValueFormattingOptions : true
|
||||
supportsWriteMemoryRequest : true
|
||||
}
|
||||
|
|
|
@ -487,6 +487,7 @@ describe('node runtime', () => {
|
|||
});
|
||||
|
||||
itIntegrates('sets arguments', async ({ r }) => {
|
||||
console.log(process.env.PATH); // todo: debug
|
||||
createFileTree(testFixturesDir, { 'test.js': 'debugger' });
|
||||
const handle = await r.runScript('test.js', {
|
||||
args: ['--some', 'very fancy', '--arguments'],
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*--------------------------------------------------------*/
|
||||
|
||||
import { testFixturesDir } from '../test';
|
||||
import { createFileTree } from '../createFileTree';
|
||||
import { NvmResolver, INvmResolver } from '../../targets/node/nvmResolver';
|
||||
import { expect } from 'chai';
|
||||
import * as path from 'path';
|
||||
import { ProtocolError } from '../../dap/protocolError';
|
||||
import { promises as fsPromises } from 'fs';
|
||||
import * as path from 'path';
|
||||
import { LocalFsUtils } from '../../common/fsUtils';
|
||||
import { ProtocolError } from '../../dap/protocolError';
|
||||
import { INvmResolver, NvmResolver } from '../../targets/node/nvmResolver';
|
||||
import { createFileTree } from '../createFileTree';
|
||||
import { testFixturesDir, testWorkspace } from '../test';
|
||||
|
||||
const fsUtils = new LocalFsUtils(fsPromises);
|
||||
|
||||
|
@ -17,7 +17,7 @@ describe('runtimeVersion', () => {
|
|||
let resolver: INvmResolver;
|
||||
|
||||
it('fails if no nvm/s present', async () => {
|
||||
resolver = new NvmResolver(fsUtils, {}, 'x64', 'linux');
|
||||
resolver = new NvmResolver(fsUtils, {}, 'x64', 'linux', testWorkspace);
|
||||
await expect(resolver.resolveNvmVersionPath('13')).to.eventually.be.rejectedWith(
|
||||
ProtocolError,
|
||||
/requires Node.js version manager/,
|
||||
|
@ -37,6 +37,7 @@ describe('runtimeVersion', () => {
|
|||
{ NVS_HOME: path.join(testFixturesDir, 'nvs'), NVM_DIR: path.join(testFixturesDir, 'nvm') },
|
||||
'x64',
|
||||
'linux',
|
||||
testWorkspace,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -59,6 +60,7 @@ describe('runtimeVersion', () => {
|
|||
{ NVM_DIR: path.join(testFixturesDir, 'nvm') },
|
||||
'x64',
|
||||
'linux',
|
||||
testWorkspace,
|
||||
);
|
||||
await expect(resolver.resolveNvmVersionPath('13.11/x64')).to.eventually.be.rejectedWith(
|
||||
ProtocolError,
|
||||
|
@ -84,7 +86,13 @@ describe('runtimeVersion', () => {
|
|||
'node/13.invalid/x64/bin/node': '',
|
||||
});
|
||||
|
||||
resolver = new NvmResolver(fsUtils, { NVS_HOME: testFixturesDir }, 'x64', 'linux');
|
||||
resolver = new NvmResolver(
|
||||
fsUtils,
|
||||
{ NVS_HOME: testFixturesDir },
|
||||
'x64',
|
||||
'linux',
|
||||
testWorkspace,
|
||||
);
|
||||
});
|
||||
|
||||
it('gets an exact match', async () => {
|
||||
|
@ -124,7 +132,13 @@ describe('runtimeVersion', () => {
|
|||
});
|
||||
|
||||
it('omits the bin directory on windows', async () => {
|
||||
resolver = new NvmResolver(fsUtils, { NVS_HOME: testFixturesDir }, 'x64', 'win32');
|
||||
resolver = new NvmResolver(
|
||||
fsUtils,
|
||||
{ NVS_HOME: testFixturesDir },
|
||||
'x64',
|
||||
'win32',
|
||||
testWorkspace,
|
||||
);
|
||||
const { directory } = await resolver.resolveNvmVersionPath('13.3.0');
|
||||
expect(directory).to.equal(path.join(testFixturesDir, 'node/13.3.0/x64'));
|
||||
});
|
||||
|
@ -139,7 +153,13 @@ describe('runtimeVersion', () => {
|
|||
'v13.invalid/node.exe': '',
|
||||
});
|
||||
|
||||
resolver = new NvmResolver(fsUtils, { NVM_HOME: testFixturesDir }, 'x64', 'win32');
|
||||
resolver = new NvmResolver(
|
||||
fsUtils,
|
||||
{ NVM_HOME: testFixturesDir },
|
||||
'x64',
|
||||
'win32',
|
||||
testWorkspace,
|
||||
);
|
||||
});
|
||||
|
||||
it('gets an exact match', async () => {
|
||||
|
@ -176,7 +196,13 @@ describe('runtimeVersion', () => {
|
|||
'versions/node/v13.invalid/bin/node': '',
|
||||
});
|
||||
|
||||
resolver = new NvmResolver(fsUtils, { NVM_DIR: testFixturesDir }, 'x64', 'linux');
|
||||
resolver = new NvmResolver(
|
||||
fsUtils,
|
||||
{ NVM_DIR: testFixturesDir },
|
||||
'x64',
|
||||
'linux',
|
||||
testWorkspace,
|
||||
);
|
||||
});
|
||||
|
||||
it('gets an exact match', async () => {
|
||||
|
|
|
@ -262,14 +262,18 @@ async function guessOutFiles(
|
|||
);
|
||||
|
||||
if (root) {
|
||||
const rel = forceForwardSlashes(path.relative(folder.uri.fsPath, root));
|
||||
let rel = forceForwardSlashes(path.relative(folder.uri.fsPath, root));
|
||||
if (rel.length > 0) {
|
||||
rel = `/${rel}`;
|
||||
}
|
||||
|
||||
config.outFiles = [
|
||||
...resolveVariableInConfig(
|
||||
baseDefaults.outFiles,
|
||||
'workspaceFolder',
|
||||
`\${workspaceFolder}/${rel}`,
|
||||
`\${workspaceFolder}${rel}`,
|
||||
),
|
||||
`!\${workspaceFolder}/${rel}/**/node_modules/**`,
|
||||
`!\${workspaceFolder}${rel}/**/node_modules/**`,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче