Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,10 @@ script:
- if [[ $AZURE_STORAGE_ACCOUNT && "$TRAVIS_BRANCH" == release* && "$TRAVIS_PULL_REQUEST" == "false" ]]; then
npm run clean;
vsce package;
azure storage blob upload python*.vsix $AZURE_STORAGE_CONTAINER ms-python-$TRAVIS_BRANCH-insiders.vsix --account-name $AZURE_STORAGE_ACCOUNT --account-key $AZURE_STORAGE_ACCESS_KEY --quiet;
npm run clean;
npm run package;
npx gulp clean:cleanExceptTests;
npm run testSmoke;
azure storage blob upload python*.vsix $AZURE_STORAGE_CONTAINER ms-python-$TRAVIS_BRANCH.vsix --account-name $AZURE_STORAGE_ACCOUNT --account-key $AZURE_STORAGE_ACCESS_KEY --quiet;
fi
75 changes: 75 additions & 0 deletions build/webpack/webpack.debugadapter.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
const tsconfig_paths_webpack_plugin_1 = require("tsconfig-paths-webpack-plugin");
const webpack_1 = require("webpack");
const constants_1 = require("../constants");
const common_1 = require("./common");
// tslint:disable-next-line:no-var-requires no-require-imports
const configFileName = path.join(constants_1.ExtensionRootDir, 'tsconfig.extension.json');
const config = {
mode: 'production',
target: 'node',
entry: {
'debugger/debugAdapter/main': './src/client/debugger/debugAdapter/main.ts'
},
devtool: 'source-map',
node: {
__dirname: false
},
module: {
rules: [
{
// JupyterServices imports node-fetch using `eval`.
test: /@jupyterlab[\\\/]services[\\\/].*js$/,
use: [
{
loader: path.join(__dirname, 'loaders', 'fixEvalRequire.js')
}
]
},
{
// Do not use __dirname in getos when using require.
test: /getos[\\\/]index.js$/,
use: [
{
loader: path.join(__dirname, 'loaders', 'fixGetosRequire.js')
}
]
},
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader'
}
]
}
]
},
externals: [
'vscode',
'commonjs'
],
plugins: [
...common_1.getDefaultPlugins('extension'),
new webpack_1.ContextReplacementPlugin(/getos/, /logic\/.*.js/)
],
resolve: {
extensions: ['.ts', '.js'],
plugins: [
new tsconfig_paths_webpack_plugin_1.TsconfigPathsPlugin({ configFile: configFileName })
]
},
output: {
filename: '[name].js',
path: path.resolve(constants_1.ExtensionRootDir, 'out', 'client'),
libraryTarget: 'commonjs2',
devtoolModuleFilenameTemplate: '../../[resource-path]'
}
};
// tslint:disable-next-line:no-default-export
exports.default = config;
79 changes: 79 additions & 0 deletions build/webpack/webpack.debugadapter.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

'use strict';

import * as path from 'path';
import { TsconfigPathsPlugin } from 'tsconfig-paths-webpack-plugin';
import { Configuration, ContextReplacementPlugin } from 'webpack';
import { ExtensionRootDir } from '../constants';
import { getDefaultPlugins } from './common';

// tslint:disable-next-line:no-var-requires no-require-imports
const configFileName = path.join(ExtensionRootDir, 'tsconfig.extension.json');

const config: Configuration = {
mode: 'production',
target: 'node',
entry: {
'debugger/debugAdapter/main': './src/client/debugger/debugAdapter/main.ts'
},
devtool: 'source-map',
node: {
__dirname: false
},
module: {
rules: [
{
// JupyterServices imports node-fetch using `eval`.
test: /@jupyterlab[\\\/]services[\\\/].*js$/,
use: [
{
loader: path.join(__dirname, 'loaders', 'fixEvalRequire.js')
}
]
},
{
// Do not use __dirname in getos when using require.
test: /getos[\\\/]index.js$/,
use: [
{
loader: path.join(__dirname, 'loaders', 'fixGetosRequire.js')
}
]
},
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader'
}
]
}
]
},
externals: [
'vscode',
'commonjs'
],
plugins: [
...getDefaultPlugins('extension'),
new ContextReplacementPlugin(/getos/, /logic\/.*.js/)
],
resolve: {
extensions: ['.ts', '.js'],
plugins: [
new TsconfigPathsPlugin({ configFile: configFileName })
]
},
output: {
filename: '[name].js',
path: path.resolve(ExtensionRootDir, 'out', 'client'),
libraryTarget: 'commonjs2',
devtoolModuleFilenameTemplate: '../../[resource-path]'
}
};

// tslint:disable-next-line:no-default-export
export default config;
3 changes: 1 addition & 2 deletions build/webpack/webpack.extension.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ const config = {
mode: 'production',
target: 'node',
entry: {
extension: './src/client/extension.ts',
'debugger/debugAdapter/main': './src/client/debugger/debugAdapter/main.ts'
extension: './src/client/extension.ts'
},
devtool: 'source-map',
node: {
Expand Down
3 changes: 1 addition & 2 deletions build/webpack/webpack.extension.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ const config: Configuration = {
mode: 'production',
target: 'node',
entry: {
extension: './src/client/extension.ts',
'debugger/debugAdapter/main': './src/client/debugger/debugAdapter/main.ts'
extension: './src/client/extension.ts'
},
devtool: 'source-map',
node: {
Expand Down
1 change: 1 addition & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ gulp.task('webpack', async () => {
await spawnAsync('npx', ['webpack', '--mode', 'production']);
await spawnAsync('npx', ['webpack', '--config', './build/webpack/webpack.extension.sourceMaps.config.js', '--mode', 'production']);
await spawnAsync('npx', ['webpack', '--config', './build/webpack/webpack.extension.config.js', '--mode', 'production']);
await spawnAsync('npx', ['webpack', '--config', './build/webpack/webpack.debugadapter.config.js', '--mode', 'production']);
});

gulp.task('prePublishBundle', gulp.series('checkNativeDependencies', 'check-datascience-dependencies', 'compile', 'clean:cleanExceptTests', 'webpack'));
Expand Down
9 changes: 4 additions & 5 deletions src/client/common/variables/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ export class EnvironmentVariablesService implements IEnvironmentVariablesService
constructor(@inject(IPathUtils) pathUtils: IPathUtils) {
this.pathVariable = pathUtils.getPathVariableName();
}
public async parseFile(filePath: string): Promise<EnvironmentVariables | undefined> {
const exists = filePath.length > 0 ? await fs.pathExists(filePath) : undefined;
if (!exists) {
return undefined;
public async parseFile(filePath?: string): Promise<EnvironmentVariables | undefined> {
if (!filePath || !await fs.pathExists(filePath)) {
return;
}
if (!fs.lstatSync(filePath).isFile()) {
return undefined;
return;
}
return dotenv.parse(await fs.readFile(filePath));
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/common/variables/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type EnvironmentVariables = Object & {
export const IEnvironmentVariablesService = Symbol('IEnvironmentVariablesService');

export interface IEnvironmentVariablesService {
parseFile(filePath: string): Promise<EnvironmentVariables | undefined>;
parseFile(filePath?: string): Promise<EnvironmentVariables | undefined>;
mergeVariables(source: EnvironmentVariables, target: EnvironmentVariables): void;
appendPythonPath(vars: EnvironmentVariables, ...pythonPaths: string[]): void;
appendPath(vars: EnvironmentVariables, ...paths: string[]): void;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

'use strict';

import { expect, use } from 'chai';
import * as chaiAsPromised from 'chai-as-promised';
import * as path from 'path';
Expand All @@ -23,6 +25,11 @@ suite('Environment Variables Service', () => {
variablesService = new EnvironmentVariablesService(pathUtils);
});

test('Custom variables should be undefined with no argument', async () => {
const vars = await variablesService.parseFile(undefined);
expect(vars).to.equal(undefined, 'Variables should be undefined');
});

test('Custom variables should be undefined with non-existent files', async () => {
const vars = await variablesService.parseFile(path.join(envFilesFolderPath, 'abcd'));
expect(vars).to.equal(undefined, 'Variables should be undefined');
Expand Down
49 changes: 49 additions & 0 deletions src/test/smoke/debugger.smoke.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

'use strict';

// tslint:disable:max-func-body-length no-invalid-this no-any

import { expect } from 'chai';
import * as fs from 'fs-extra';
import * as path from 'path';
import * as vscode from 'vscode';
import { openFile, waitForCondition } from '../common';
import { EXTENSION_ROOT_DIR_FOR_TESTS, IS_SMOKE_TEST } from '../constants';
import { closeActiveWindows, initializeTest } from '../initialize';

suite('Smoke Test: Debug file', function () {
// Large value to allow for LS to get downloaded.
this.timeout(4 * 60_000);

suiteSetup(function () {
if (!IS_SMOKE_TEST) {
return this.skip();
}
});
setup(initializeTest);
suiteTeardown(closeActiveWindows);
teardown(closeActiveWindows);

test('Debug', async () => {
const file = path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'src', 'testMultiRootWkspc', 'smokeTests', 'testExecInTerminal.py');
const outputFile = path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'src', 'testMultiRootWkspc', 'smokeTests', 'testExecInTerminal.log');
if (await fs.pathExists(outputFile)) {
await fs.unlink(outputFile);
}
await openFile(file);

const config = {
name: 'Debug',
request: 'launch',
type: 'python',
program: file
};

const started = await vscode.debug.startDebugging(vscode.workspace.workspaceFolders![0], config);
expect(started).to.be.equal(true, 'Debugger did not sart');
const checkIfFileHasBeenCreated = () => fs.pathExists(outputFile);
await waitForCondition(checkIfFileHasBeenCreated, 30_000, '\'testExecInTerminal.log\' file not created');
});
});