Archived
1
0

chore(vscode): update to 1.56.0

This commit is contained in:
Akash Satheesan
2021-04-30 20:25:17 +05:30
1749 changed files with 88014 additions and 43316 deletions

View File

@ -32,17 +32,19 @@ suite('vscode API - env', () => {
test('env.remoteName', function () {
const remoteName = env.remoteName;
const knownWorkspaceExtension = extensions.getExtension('vscode.git');
const knownUiExtension = extensions.getExtension('vscode.git-ui');
const knownUiAndWorkspaceExtension = extensions.getExtension('vscode.image-preview');
if (typeof remoteName === 'undefined') {
// not running in remote, so we expect both extensions
assert.ok(knownWorkspaceExtension);
assert.ok(knownUiExtension);
assert.equal(ExtensionKind.UI, knownUiExtension!.extensionKind);
assert.ok(knownUiAndWorkspaceExtension);
assert.equal(ExtensionKind.UI, knownUiAndWorkspaceExtension!.extensionKind);
} else if (typeof remoteName === 'string') {
// running in remote, so we only expect workspace extensions
assert.ok(knownWorkspaceExtension);
if (env.uiKind === UIKind.Desktop) {
assert.ok(!knownUiExtension); // we currently can only access extensions that run on same host
assert.ok(!knownUiAndWorkspaceExtension); // we currently can only access extensions that run on same host
} else {
assert.ok(knownUiAndWorkspaceExtension);
}
assert.equal(ExtensionKind.Workspace, knownWorkspaceExtension!.extensionKind);
} else {

View File

@ -8,7 +8,7 @@ const testRunner = require('../../../../test/integration/electron/testrunner');
const options: any = {
ui: 'tdd',
color: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
color: true,
timeout: 60000
};

View File

@ -9,16 +9,25 @@ import * as utils from '../utils';
suite('Notebook Document', function () {
const contentProvider = new class implements vscode.NotebookContentProvider {
const simpleContentProvider = new class implements vscode.NotebookSerializer {
deserializeNotebook(_data: Uint8Array): vscode.NotebookData | Thenable<vscode.NotebookData> {
return new vscode.NotebookData(
[new vscode.NotebookCellData(vscode.NotebookCellKind.Code, '// SIMPLE', 'javascript')],
new vscode.NotebookDocumentMetadata()
);
}
serializeNotebook(_data: vscode.NotebookData): Uint8Array | Thenable<Uint8Array> {
return new Uint8Array();
}
};
const complexContentProvider = new class implements vscode.NotebookContentProvider {
async openNotebook(uri: vscode.Uri, _openContext: vscode.NotebookDocumentOpenContext): Promise<vscode.NotebookData> {
return new vscode.NotebookData(
[new vscode.NotebookCellData(vscode.NotebookCellKind.Code, uri.toString(), 'javascript')],
new vscode.NotebookDocumentMetadata()
);
}
async resolveNotebook(_document: vscode.NotebookDocument, _webview: vscode.NotebookCommunication) {
//
}
async saveNotebook(_document: vscode.NotebookDocument, _cancellation: vscode.CancellationToken) {
//
}
@ -45,13 +54,17 @@ suite('Notebook Document', function () {
});
suiteSetup(function () {
disposables.push(vscode.notebook.registerNotebookContentProvider('notebook.nbdtest', contentProvider));
disposables.push(vscode.notebook.registerNotebookContentProvider('notebook.nbdtest', complexContentProvider));
disposables.push(vscode.notebook.registerNotebookSerializer('notebook.nbdserializer', simpleContentProvider));
});
test('cannot register sample provider multiple times', function () {
assert.throws(() => {
vscode.notebook.registerNotebookContentProvider('notebook.nbdtest', contentProvider);
vscode.notebook.registerNotebookContentProvider('notebook.nbdtest', complexContentProvider);
});
// assert.throws(() => {
// vscode.notebook.registerNotebookSerializer('notebook.nbdserializer', simpleContentProvider);
// });
});
test('cannot open unknown types', async function () {
@ -70,7 +83,7 @@ suite('Notebook Document', function () {
assert.strictEqual(notebook.uri.toString(), uri.toString());
assert.strictEqual(notebook.isDirty, false);
assert.strictEqual(notebook.isUntitled, false);
assert.strictEqual(notebook.cells.length, 1);
assert.strictEqual(notebook.cellCount, 1);
assert.strictEqual(notebook.viewType, 'notebook.nbdtest');
});
@ -83,7 +96,7 @@ suite('Notebook Document', function () {
return;
}
const notebook = vscode.notebook.notebookDocuments.find(notebook => {
const cell = notebook.cells.find(cell => cell.document === doc);
const cell = notebook.getCells().find(cell => cell.document === doc);
return Boolean(cell);
});
assert.ok(notebook, `notebook for cell ${doc.uri} NOT found`);
@ -99,7 +112,9 @@ suite('Notebook Document', function () {
const uri = await utils.createRandomFile(undefined, undefined, '.nbdtest');
const p = utils.asPromise(vscode.notebook.onDidOpenNotebookDocument).then(notebook => {
for (let cell of notebook.cells) {
for (let i = 0; i < notebook.cellCount; i++) {
let cell = notebook.cellAt(i);
const doc = vscode.workspace.textDocuments.find(doc => doc.uri.toString() === cell.document.uri.toString());
assert.ok(doc);
assert.strictEqual(doc.notebook === notebook, true);
@ -119,12 +134,12 @@ suite('Notebook Document', function () {
const uri = await utils.createRandomFile(undefined, undefined, '.nbdtest');
const document = await vscode.notebook.openNotebookDocument(uri);
assert.strictEqual(document.cells.length, 1);
assert.strictEqual(document.cellCount, 1);
// inserting two new cells
{
const edit = new vscode.WorkspaceEdit();
edit.replaceNotebookCells(document.uri, 0, 0, [{
edit.replaceNotebookCells(document.uri, new vscode.NotebookRange(0, 0), [{
kind: vscode.NotebookCellKind.Markdown,
language: 'markdown',
metadata: undefined,
@ -142,26 +157,26 @@ suite('Notebook Document', function () {
assert.strictEqual(success, true);
}
assert.strictEqual(document.cells.length, 3);
assert.strictEqual(document.cells[0].document.getText(), 'new_markdown');
assert.strictEqual(document.cells[1].document.getText(), 'new_code');
assert.strictEqual(document.cellCount, 3);
assert.strictEqual(document.cellAt(0).document.getText(), 'new_markdown');
assert.strictEqual(document.cellAt(1).document.getText(), 'new_code');
// deleting cell 1 and 3
{
const edit = new vscode.WorkspaceEdit();
edit.replaceNotebookCells(document.uri, 0, 1, []);
edit.replaceNotebookCells(document.uri, 2, 3, []);
edit.replaceNotebookCells(document.uri, new vscode.NotebookRange(0, 1), []);
edit.replaceNotebookCells(document.uri, new vscode.NotebookRange(2, 3), []);
const success = await vscode.workspace.applyEdit(edit);
assert.strictEqual(success, true);
}
assert.strictEqual(document.cells.length, 1);
assert.strictEqual(document.cells[0].document.getText(), 'new_code');
assert.strictEqual(document.cellCount, 1);
assert.strictEqual(document.cellAt(0).document.getText(), 'new_code');
// replacing all cells
{
const edit = new vscode.WorkspaceEdit();
edit.replaceNotebookCells(document.uri, 0, 1, [{
edit.replaceNotebookCells(document.uri, new vscode.NotebookRange(0, 1), [{
kind: vscode.NotebookCellKind.Markdown,
language: 'markdown',
metadata: undefined,
@ -177,27 +192,27 @@ suite('Notebook Document', function () {
const success = await vscode.workspace.applyEdit(edit);
assert.strictEqual(success, true);
}
assert.strictEqual(document.cells.length, 2);
assert.strictEqual(document.cells[0].document.getText(), 'new2_markdown');
assert.strictEqual(document.cells[1].document.getText(), 'new2_code');
assert.strictEqual(document.cellCount, 2);
assert.strictEqual(document.cellAt(0).document.getText(), 'new2_markdown');
assert.strictEqual(document.cellAt(1).document.getText(), 'new2_code');
// remove all cells
{
const edit = new vscode.WorkspaceEdit();
edit.replaceNotebookCells(document.uri, 0, document.cells.length, []);
edit.replaceNotebookCells(document.uri, new vscode.NotebookRange(0, document.cellCount), []);
const success = await vscode.workspace.applyEdit(edit);
assert.strictEqual(success, true);
}
assert.strictEqual(document.cells.length, 0);
assert.strictEqual(document.cellCount, 0);
});
test('workspace edit API (replaceCells, event)', async function () {
const uri = await utils.createRandomFile(undefined, undefined, '.nbdtest');
const document = await vscode.notebook.openNotebookDocument(uri);
assert.strictEqual(document.cells.length, 1);
assert.strictEqual(document.cellCount, 1);
const edit = new vscode.WorkspaceEdit();
edit.replaceNotebookCells(document.uri, 0, 0, [{
edit.replaceNotebookCells(document.uri, new vscode.NotebookRange(0, 0), [{
kind: vscode.NotebookCellKind.Markdown,
language: 'markdown',
metadata: undefined,
@ -219,9 +234,9 @@ suite('Notebook Document', function () {
const data = await event;
// check document
assert.strictEqual(document.cells.length, 3);
assert.strictEqual(document.cells[0].document.getText(), 'new_markdown');
assert.strictEqual(document.cells[1].document.getText(), 'new_code');
assert.strictEqual(document.cellCount, 3);
assert.strictEqual(document.cellAt(0).document.getText(), 'new_markdown');
assert.strictEqual(document.cellAt(1).document.getText(), 'new_code');
// check event data
assert.strictEqual(data.document === document, true);
@ -229,69 +244,8 @@ suite('Notebook Document', function () {
assert.strictEqual(data.changes[0].deletedCount, 0);
assert.strictEqual(data.changes[0].deletedItems.length, 0);
assert.strictEqual(data.changes[0].items.length, 2);
assert.strictEqual(data.changes[0].items[0], document.cells[0]);
assert.strictEqual(data.changes[0].items[1], document.cells[1]);
});
test('workspace edit API (appendNotebookCellOutput, replaceCellOutput, event)', async function () {
const uri = await utils.createRandomFile(undefined, undefined, '.nbdtest');
const document = await vscode.notebook.openNotebookDocument(uri);
const outputChangeEvent = utils.asPromise<vscode.NotebookCellOutputsChangeEvent>(vscode.notebook.onDidChangeCellOutputs);
const edit = new vscode.WorkspaceEdit();
const firstCellOutput = new vscode.NotebookCellOutput([new vscode.NotebookCellOutputItem('foo', 'bar')]);
edit.appendNotebookCellOutput(document.uri, 0, [firstCellOutput]);
const success = await vscode.workspace.applyEdit(edit);
const data = await outputChangeEvent;
assert.strictEqual(success, true);
assert.strictEqual(document.cells.length, 1);
assert.strictEqual(document.cells[0].outputs.length, 1);
assert.deepStrictEqual(document.cells[0].outputs, [firstCellOutput]);
assert.strictEqual(data.document === document, true);
assert.strictEqual(data.cells.length, 1);
assert.strictEqual(data.cells[0].outputs.length, 1);
assert.deepStrictEqual(data.cells[0].outputs, [firstCellOutput]);
{
const outputChangeEvent = utils.asPromise<vscode.NotebookCellOutputsChangeEvent>(vscode.notebook.onDidChangeCellOutputs);
const edit = new vscode.WorkspaceEdit();
const secondCellOutput = new vscode.NotebookCellOutput([new vscode.NotebookCellOutputItem('foo', 'baz')]);
edit.appendNotebookCellOutput(document.uri, 0, [secondCellOutput]);
const success = await vscode.workspace.applyEdit(edit);
const data = await outputChangeEvent;
assert.strictEqual(success, true);
assert.strictEqual(document.cells.length, 1);
assert.strictEqual(document.cells[0].outputs.length, 2);
assert.deepStrictEqual(document.cells[0].outputs, [firstCellOutput, secondCellOutput]);
assert.strictEqual(data.document === document, true);
assert.strictEqual(data.cells.length, 1);
assert.strictEqual(data.cells[0].outputs.length, 2);
assert.deepStrictEqual(data.cells[0].outputs, [firstCellOutput, secondCellOutput]);
}
{
const outputChangeEvent = utils.asPromise<vscode.NotebookCellOutputsChangeEvent>(vscode.notebook.onDidChangeCellOutputs);
const edit = new vscode.WorkspaceEdit();
const thirdOutput = new vscode.NotebookCellOutput([new vscode.NotebookCellOutputItem('foo', 'baz1')]);
edit.replaceNotebookCellOutput(document.uri, 0, [thirdOutput]);
const success = await vscode.workspace.applyEdit(edit);
const data = await outputChangeEvent;
assert.strictEqual(success, true);
assert.strictEqual(document.cells.length, 1);
assert.strictEqual(document.cells[0].outputs.length, 1);
assert.deepStrictEqual(document.cells[0].outputs, [thirdOutput]);
assert.strictEqual(data.document === document, true);
assert.strictEqual(data.cells.length, 1);
assert.strictEqual(data.cells[0].outputs.length, 1);
assert.deepStrictEqual(data.cells[0].outputs, [thirdOutput]);
}
assert.strictEqual(data.changes[0].items[0], document.cellAt(0));
assert.strictEqual(data.changes[0].items[1], document.cellAt(1));
});
test('document save API', async function () {
@ -301,11 +255,11 @@ suite('Notebook Document', function () {
assert.strictEqual(notebook.uri.toString(), uri.toString());
assert.strictEqual(notebook.isDirty, false);
assert.strictEqual(notebook.isUntitled, false);
assert.strictEqual(notebook.cells.length, 1);
assert.strictEqual(notebook.cellCount, 1);
assert.strictEqual(notebook.viewType, 'notebook.nbdtest');
const edit = new vscode.WorkspaceEdit();
edit.replaceNotebookCells(notebook.uri, 0, 0, [{
edit.replaceNotebookCells(notebook.uri, new vscode.NotebookRange(0, 0), [{
kind: vscode.NotebookCellKind.Markdown,
language: 'markdown',
metadata: undefined,
@ -332,7 +286,7 @@ suite('Notebook Document', function () {
const uri = await utils.createRandomFile(undefined, undefined, '.nbdtest');
const notebook = await vscode.notebook.openNotebookDocument(uri);
const first = notebook.cells[0];
const first = notebook.cellAt(0);
assert.strictEqual(first.document.languageId, 'javascript');
const pclose = utils.asPromise(vscode.workspace.onDidCloseTextDocument);
@ -349,43 +303,44 @@ suite('Notebook Document', function () {
assert.strictEqual(opened === closed, true);
});
test('setTextDocumentLanguage when notebook editor is not open', async function () {
const uri = await utils.createRandomFile('', undefined, '.nbdtest');
const notebook = await vscode.notebook.openNotebookDocument(uri);
const firstCelUri = notebook.cellAt(0).document.uri;
await vscode.commands.executeCommand('workbench.action.closeActiveEditor');
test('#117273, Add multiple outputs', async function () {
let cellDoc = await vscode.workspace.openTextDocument(firstCelUri);
cellDoc = await vscode.languages.setTextDocumentLanguage(cellDoc, 'css');
assert.strictEqual(cellDoc.languageId, 'css');
});
test('dirty state - complex', async function () {
const resource = await utils.createRandomFile(undefined, undefined, '.nbdtest');
const document = await vscode.notebook.openNotebookDocument(resource);
assert.strictEqual(document.isDirty, false);
const edit = new vscode.WorkspaceEdit();
edit.replaceNotebookCellOutput(document.uri, 0, [
new vscode.NotebookCellOutput(
[new vscode.NotebookCellOutputItem('application/x.notebook.stream', '1', { outputType: 'stream', streamName: 'stdout' })],
{ outputType: 'stream', streamName: 'stdout' }
)
]);
let success = await vscode.workspace.applyEdit(edit);
edit.replaceNotebookCells(document.uri, new vscode.NotebookRange(0, document.cellCount), []);
assert.ok(await vscode.workspace.applyEdit(edit));
assert.ok(success);
assert.strictEqual(document.cells[0].outputs.length, 1);
assert.strictEqual(document.cells[0].outputs[0].outputs.length, 1);
assert.deepStrictEqual(document.cells[0].outputs[0].metadata, { outputType: 'stream', streamName: 'stdout' });
assert.deepStrictEqual(document.cells[0].outputs[0].outputs[0].metadata, { outputType: 'stream', streamName: 'stdout' });
assert.strictEqual(document.isDirty, true);
const edit2 = new vscode.WorkspaceEdit();
edit2.appendNotebookCellOutput(document.uri, 0, [
new vscode.NotebookCellOutput(
[new vscode.NotebookCellOutputItem('hello', '1', { outputType: 'stream', streamName: 'stderr' })],
{ outputType: 'stream', streamName: 'stderr' }
)
]);
success = await vscode.workspace.applyEdit(edit2);
assert.ok(success);
await document.save();
assert.strictEqual(document.isDirty, false);
});
assert.strictEqual(document.cells[0].outputs.length, 2);
assert.strictEqual(document.cells[0].outputs[0].outputs.length, 1);
assert.strictEqual(document.cells[0].outputs[1].outputs.length, 1);
assert.deepStrictEqual(document.cells[0].outputs[0].metadata, { outputType: 'stream', streamName: 'stdout' });
assert.deepStrictEqual(document.cells[0].outputs[0].outputs[0].metadata, { outputType: 'stream', streamName: 'stdout' });
assert.deepStrictEqual(document.cells[0].outputs[1].metadata, { outputType: 'stream', streamName: 'stderr' });
assert.deepStrictEqual(document.cells[0].outputs[1].outputs[0].metadata, { outputType: 'stream', streamName: 'stderr' });
test('dirty state - serializer', async function () {
const resource = await utils.createRandomFile(undefined, undefined, '.nbdserializer');
const document = await vscode.notebook.openNotebookDocument(resource);
assert.strictEqual(document.isDirty, false);
const edit = new vscode.WorkspaceEdit();
edit.replaceNotebookCells(document.uri, new vscode.NotebookRange(0, document.cellCount), []);
assert.ok(await vscode.workspace.applyEdit(edit));
assert.strictEqual(document.isDirty, true);
await document.save();
assert.strictEqual(document.isDirty, false);
});
});

View File

@ -9,25 +9,15 @@ import * as utils from '../utils';
suite('Notebook Editor', function () {
const contentProvider = new class implements vscode.NotebookContentProvider {
async openNotebook(uri: vscode.Uri, _openContext: vscode.NotebookDocumentOpenContext): Promise<vscode.NotebookData> {
const contentSerializer = new class implements vscode.NotebookSerializer {
deserializeNotebook() {
return new vscode.NotebookData(
[new vscode.NotebookCellData(vscode.NotebookCellKind.Code, uri.toString(), 'javascript')],
[new vscode.NotebookCellData(vscode.NotebookCellKind.Code, '// code cell', 'javascript')],
new vscode.NotebookDocumentMetadata()
);
}
async resolveNotebook(_document: vscode.NotebookDocument, _webview: vscode.NotebookCommunication) {
//
}
async saveNotebook(_document: vscode.NotebookDocument, _cancellation: vscode.CancellationToken) {
//
}
async saveNotebookAs(_targetResource: vscode.Uri, _document: vscode.NotebookDocument, _cancellation: vscode.CancellationToken) {
//
}
async backupNotebook(_document: vscode.NotebookDocument, _context: vscode.NotebookDocumentBackupContext, _cancellation: vscode.CancellationToken) {
return { id: '', delete() { } };
serializeNotebook() {
return new Uint8Array();
}
};
@ -46,7 +36,7 @@ suite('Notebook Editor', function () {
});
suiteSetup(function () {
disposables.push(vscode.notebook.registerNotebookContentProvider('notebook.nbdtest', contentProvider));
disposables.push(vscode.notebook.registerNotebookSerializer('notebook.nbdtest', contentSerializer));
});
@ -68,6 +58,18 @@ suite('Notebook Editor', function () {
});
test('notebook editor has viewColumn', async function () {
const uri1 = await utils.createRandomFile(undefined, undefined, '.nbdtest');
const editor1 = await vscode.window.showNotebookDocument(uri1);
assert.strictEqual(editor1.viewColumn, vscode.ViewColumn.One);
const uri2 = await utils.createRandomFile(undefined, undefined, '.nbdtest');
const editor2 = await vscode.window.showNotebookDocument(uri2, { viewColumn: vscode.ViewColumn.Beside });
assert.strictEqual(editor2.viewColumn, vscode.ViewColumn.Two);
});
test.skip('Opening a notebook should fire activeNotebook event changed only once', async function () {
const openedEditor = utils.asPromise(vscode.window.onDidChangeActiveNotebookEditor);
const resource = await utils.createRandomFile(undefined, undefined, '.nbdtest');

View File

@ -23,7 +23,7 @@ import { assertNoRpc } from '../utils';
// Disable exit alerts as tests may trigger then and we're not testing the notifications
await config.update('showExitAlert', false, ConfigurationTarget.Global);
// Canvas may cause problems when running in a container
await config.update('rendererType', 'dom', ConfigurationTarget.Global);
await config.update('gpuAcceleration', 'off', ConfigurationTarget.Global);
// Disable env var relaunch for tests to prevent terminals relaunching themselves
await config.update('environmentChangesRelaunch', false, ConfigurationTarget.Global);
});
@ -468,7 +468,7 @@ import { assertNoRpc } from '../utils';
// const terminal = window.createTerminal({ name: 'foo', pty });
// });
test('should respect dimension overrides', (done) => {
test.skip('should respect dimension overrides', (done) => {
disposables.push(window.onDidOpenTerminal(term => {
try {
equal(terminal, term);
@ -633,8 +633,9 @@ import { assertNoRpc } from '../utils';
});
});
suite('environmentVariableCollection', () => {
test.skip('should have collection variables apply to terminals immediately after setting', (done) => {
// https://github.com/microsoft/vscode/issues/119826
suite.skip('environmentVariableCollection', () => {
test('should have collection variables apply to terminals immediately after setting', (done) => {
// Text to match on before passing the test
const expectedText = [
'~a2~',

View File

@ -399,6 +399,118 @@ suite.skip('vscode API - webview', () => {
assert.strictEqual(await vscode.env.clipboard.readText(), expectedText);
});
}
test('webviews should transfer ArrayBuffers to and from webviews', async () => {
const webview = _register(vscode.window.createWebviewPanel(webviewId, 'title', { viewColumn: vscode.ViewColumn.One }, { enableScripts: true, retainContextWhenHidden: true }));
const ready = getMessage(webview);
webview.webview.html = createHtmlDocumentWithBody(/*html*/`
<script>
const vscode = acquireVsCodeApi();
window.addEventListener('message', (message) => {
switch (message.data.type) {
case 'add1':
const arrayBuffer = message.data.array;
const uint8Array = new Uint8Array(arrayBuffer);
for (let i = 0; i < uint8Array.length; ++i) {
uint8Array[i] = uint8Array[i] + 1;
}
vscode.postMessage({ array: arrayBuffer }, [arrayBuffer]);
break;
}
});
vscode.postMessage({ type: 'ready' });
</script>`);
await ready;
const responsePromise = getMessage(webview);
const bufferLen = 100;
{
const arrayBuffer = new ArrayBuffer(bufferLen);
const uint8Array = new Uint8Array(arrayBuffer);
for (let i = 0; i < bufferLen; ++i) {
uint8Array[i] = i;
}
webview.webview.postMessage({
type: 'add1',
array: arrayBuffer
});
}
{
const response = await responsePromise;
assert.ok(response.array instanceof ArrayBuffer);
const uint8Array = new Uint8Array(response.array);
for (let i = 0; i < bufferLen; ++i) {
assert.strictEqual(uint8Array[i], i + 1);
}
}
});
test('webviews should transfer Typed arrays to and from webviews', async () => {
const webview = _register(vscode.window.createWebviewPanel(webviewId, 'title', { viewColumn: vscode.ViewColumn.One }, { enableScripts: true, retainContextWhenHidden: true }));
const ready = getMessage(webview);
webview.webview.html = createHtmlDocumentWithBody(/*html*/`
<script>
const vscode = acquireVsCodeApi();
window.addEventListener('message', (message) => {
switch (message.data.type) {
case 'add1':
const uint8Array = message.data.array1;
// This should update both buffers since they use the same ArrayBuffer storage
const uint16Array = message.data.array2;
for (let i = 0; i < uint16Array.length; ++i) {
uint16Array[i] = uint16Array[i] + 1;
}
vscode.postMessage({ array1: uint8Array, array2: uint16Array, }, [uint16Array.buffer]);
break;
}
});
vscode.postMessage({ type: 'ready' });
</script>`);
await ready;
const responsePromise = getMessage(webview);
const bufferLen = 100;
{
const arrayBuffer = new ArrayBuffer(bufferLen);
const uint8Array = new Uint8Array(arrayBuffer);
const uint16Array = new Uint16Array(arrayBuffer);
for (let i = 0; i < uint16Array.length; ++i) {
uint16Array[i] = i;
}
webview.webview.postMessage({
type: 'add1',
array1: uint8Array,
array2: uint16Array,
});
}
{
const response = await responsePromise;
assert.ok(response.array1 instanceof Uint8Array);
assert.ok(response.array2 instanceof Uint16Array);
assert.ok(response.array1.buffer === response.array2.buffer);
const uint8Array = response.array1;
for (let i = 0; i < bufferLen; ++i) {
if (i % 2 === 0) {
assert.strictEqual(uint8Array[i], Math.floor(i / 2) + 1);
} else {
assert.strictEqual(uint8Array[i], 0);
}
}
}
});
});
function createHtmlDocumentWithBody(body: string): string {

View File

@ -157,7 +157,7 @@ suite('vscode API - window', () => {
return;
}
if (process.env['BUILD_SOURCEVERSION']) {
if (process.env['BUILD_SOURCEVERSION'] || process.env['CI']) {
this.skip();
return;
}

View File

@ -18,7 +18,7 @@ import { assertNoRpc } from '../utils';
// Disable exit alerts as tests may trigger then and we're not testing the notifications
await config.update('showExitAlert', false, ConfigurationTarget.Global);
// Canvas may cause problems when running in a container
await config.update('rendererType', 'dom', ConfigurationTarget.Global);
await config.update('gpuAcceleration', 'off', ConfigurationTarget.Global);
// Disable env var relaunch for tests to prevent terminals relaunching themselves
await config.update('environmentChangesRelaunch', false, ConfigurationTarget.Global);
});
@ -131,6 +131,7 @@ import { assertNoRpc } from '../utils';
suite('CustomExecution', () => {
test('task should start and shutdown successfully', async () => {
window.terminals.forEach(terminal => terminal.dispose());
interface CustomTestingTaskDefinition extends TaskDefinition {
/**
* One of the task properties. This can be used to customize the task in the tasks.json
@ -203,7 +204,10 @@ import { assertNoRpc } from '../utils';
// Dispose the terminal
await new Promise<void>(r => {
disposables.push(window.onDidCloseTerminal(() => {
disposables.push(window.onDidCloseTerminal((e) => {
if (e !== terminal) {
return;
}
assert.strictEqual(testOrder, TestOrder.TerminalWritten);
testOrder = TestOrder.TerminalClosed;
// Pseudoterminal.close should have fired by now, additionally we want

View File

@ -619,7 +619,7 @@ suite('vscode API - workspace', () => {
assert.equal(results.length, 1);
const match = <vscode.TextSearchMatch>results[0];
assert(match.preview.text.indexOf('foo') >= 0);
assert.equal(vscode.workspace.asRelativePath(match.uri), '10linefile.ts');
assert.equal(basename(vscode.workspace.asRelativePath(match.uri)), '10linefile.ts');
});
test('findTextInFiles, cancellation', async () => {

View File

@ -122,7 +122,7 @@ export function assertNoRpcFromEntry(entry: [obj: any, name: string]) {
assert.strictEqual(proxyPaths.length, 0, proxyPaths.join('\n')); // happens...
}
export async function asPromise<T>(event: vscode.Event<T>, timeout = 5000): Promise<T> {
export async function asPromise<T>(event: vscode.Event<T>, timeout = vscode.env.uiKind === vscode.UIKind.Desktop ? 5000 : 15000): Promise<T> {
return new Promise<T>((resolve, reject) => {
const handle = setTimeout(() => {

View File

@ -8,7 +8,7 @@ const testRunner = require('../../../../test/integration/electron/testrunner');
const options: any = {
ui: 'tdd',
color: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
color: true,
timeout: 60000
};