Merge VS Code 1.23.1 (#1520)

This commit is contained in:
Matt Irvine
2018-06-05 11:24:51 -07:00
committed by GitHub
parent e3baf5c443
commit 0c58f09e59
3651 changed files with 74249 additions and 48599 deletions

View File

@@ -5,16 +5,15 @@
'use strict';
import assert = require('assert');
import os = require('os');
import * as assert from 'assert';
import * as os from 'os';
import path = require('path');
import fs = require('fs');
import * as path from 'path';
import * as fs from 'fs';
import uuid = require('vs/base/common/uuid');
import strings = require('vs/base/common/strings');
import extfs = require('vs/base/node/extfs');
import { onError } from 'vs/base/test/common/utils';
import * as uuid from 'vs/base/common/uuid';
import * as strings from 'vs/base/common/strings';
import * as extfs from 'vs/base/node/extfs';
import { Readable } from 'stream';
import { isLinux, isWindows } from 'vs/base/common/platform';
@@ -58,14 +57,14 @@ function toReadable(value: string, throwError?: boolean): Readable {
suite('Extfs', () => {
test('mkdirp', function (done: () => void) {
test('mkdirp', function (done) {
const id = uuid.generateUuid();
const parentDir = path.join(os.tmpdir(), 'vsctests', id);
const newDir = path.join(parentDir, 'extfs', id);
mkdirp(newDir, 493, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.ok(fs.existsSync(newDir));
@@ -74,7 +73,7 @@ suite('Extfs', () => {
}); // 493 = 0755
});
test('stat link', function (done: () => void) {
test('stat link', function (done) {
if (isWindows) {
// Symlinks are not the same on win, and we can not create them programitically without admin privileges
return done();
@@ -89,21 +88,21 @@ suite('Extfs', () => {
mkdirp(directory, 493, error => {
if (error) {
return onError(error, done);
return done(error);
}
fs.symlinkSync(directory, symbolicLink);
extfs.statLink(directory, (error, statAndIsLink) => {
if (error) {
return onError(error, done);
return done(error);
}
assert.ok(!statAndIsLink.isSymbolicLink);
extfs.statLink(symbolicLink, (error, statAndIsLink) => {
if (error) {
return onError(error, done);
return done(error);
}
assert.ok(statAndIsLink.isSymbolicLink);
@@ -124,14 +123,14 @@ suite('Extfs', () => {
assert.ok(!fs.existsSync(newDir));
});
test('delSync - simple', function (done: () => void) {
test('delSync - simple', function (done) {
const id = uuid.generateUuid();
const parentDir = path.join(os.tmpdir(), 'vsctests', id);
const newDir = path.join(parentDir, 'extfs', id);
mkdirp(newDir, 493, error => {
if (error) {
return onError(error, done);
return done(error);
}
fs.writeFileSync(path.join(newDir, 'somefile.txt'), 'Contents');
@@ -144,14 +143,14 @@ suite('Extfs', () => {
}); // 493 = 0755
});
test('delSync - recursive folder structure', function (done: () => void) {
test('delSync - recursive folder structure', function (done) {
const id = uuid.generateUuid();
const parentDir = path.join(os.tmpdir(), 'vsctests', id);
const newDir = path.join(parentDir, 'extfs', id);
mkdirp(newDir, 493, error => {
if (error) {
return onError(error, done);
return done(error);
}
fs.writeFileSync(path.join(newDir, 'somefile.txt'), 'Contents');
@@ -167,7 +166,7 @@ suite('Extfs', () => {
}); // 493 = 0755
});
test('copy, move and delete', function (done: () => void) {
test('copy, move and delete', function (done) {
const id = uuid.generateUuid();
const id2 = uuid.generateUuid();
const sourceDir = require.toUrl('./fixtures');
@@ -177,7 +176,7 @@ suite('Extfs', () => {
extfs.copy(sourceDir, targetDir, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.ok(fs.existsSync(targetDir));
@@ -189,7 +188,7 @@ suite('Extfs', () => {
extfs.mv(targetDir, targetDir2, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.ok(!fs.existsSync(targetDir));
@@ -202,7 +201,7 @@ suite('Extfs', () => {
extfs.mv(path.join(targetDir2, 'index.html'), path.join(targetDir2, 'index_moved.html'), error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.ok(!fs.existsSync(path.join(targetDir2, 'index.html')));
@@ -210,11 +209,11 @@ suite('Extfs', () => {
extfs.del(parentDir, os.tmpdir(), error => {
if (error) {
return onError(error, done);
return done(error);
}
}, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.ok(!fs.existsSync(parentDir));
done();
@@ -224,7 +223,7 @@ suite('Extfs', () => {
});
});
test('readdir', function (done: () => void) {
test('readdir', function (done) {
if (strings.canNormalize && typeof process.versions['electron'] !== 'undefined' /* needs electron */) {
const id = uuid.generateUuid();
const parentDir = path.join(os.tmpdir(), 'vsctests', id);
@@ -232,7 +231,7 @@ suite('Extfs', () => {
mkdirp(newDir, 493, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.ok(fs.existsSync(newDir));
@@ -248,7 +247,7 @@ suite('Extfs', () => {
}
});
test('writeFileAndFlush (string)', function (done: () => void) {
test('writeFileAndFlush (string)', function (done) {
const id = uuid.generateUuid();
const parentDir = path.join(os.tmpdir(), 'vsctests', id);
const newDir = path.join(parentDir, 'extfs', id);
@@ -256,14 +255,14 @@ suite('Extfs', () => {
mkdirp(newDir, 493, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.ok(fs.existsSync(newDir));
extfs.writeFileAndFlush(testFile, 'Hello World', null, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.equal(fs.readFileSync(testFile), 'Hello World');
@@ -272,7 +271,7 @@ suite('Extfs', () => {
extfs.writeFileAndFlush(testFile, largeString, null, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.equal(fs.readFileSync(testFile), largeString);
@@ -283,7 +282,7 @@ suite('Extfs', () => {
});
});
test('writeFileAndFlush (stream)', function (done: () => void) {
test('writeFileAndFlush (stream)', function (done) {
const id = uuid.generateUuid();
const parentDir = path.join(os.tmpdir(), 'vsctests', id);
const newDir = path.join(parentDir, 'extfs', id);
@@ -291,14 +290,14 @@ suite('Extfs', () => {
mkdirp(newDir, 493, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.ok(fs.existsSync(newDir));
extfs.writeFileAndFlush(testFile, toReadable('Hello World'), null, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.equal(fs.readFileSync(testFile), 'Hello World');
@@ -307,7 +306,7 @@ suite('Extfs', () => {
extfs.writeFileAndFlush(testFile, toReadable(largeString), null, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.equal(fs.readFileSync(testFile), largeString);
@@ -318,7 +317,7 @@ suite('Extfs', () => {
});
});
test('writeFileAndFlush (file stream)', function (done: () => void) {
test('writeFileAndFlush (file stream)', function (done) {
const id = uuid.generateUuid();
const parentDir = path.join(os.tmpdir(), 'vsctests', id);
const sourceFile = require.toUrl('./fixtures/index.html');
@@ -327,14 +326,14 @@ suite('Extfs', () => {
mkdirp(newDir, 493, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.ok(fs.existsSync(newDir));
extfs.writeFileAndFlush(testFile, fs.createReadStream(sourceFile), null, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.equal(fs.readFileSync(testFile).toString(), fs.readFileSync(sourceFile).toString());
@@ -344,7 +343,7 @@ suite('Extfs', () => {
});
});
test('writeFileAndFlush (string, error handling)', function (done: () => void) {
test('writeFileAndFlush (string, error handling)', function (done) {
const id = uuid.generateUuid();
const parentDir = path.join(os.tmpdir(), 'vsctests', id);
const newDir = path.join(parentDir, 'extfs', id);
@@ -352,7 +351,7 @@ suite('Extfs', () => {
mkdirp(newDir, 493, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.ok(fs.existsSync(newDir));
@@ -361,7 +360,7 @@ suite('Extfs', () => {
extfs.writeFileAndFlush(testFile, 'Hello World', null, error => {
if (!error) {
return onError(new Error('Expected error for writing to readonly file'), done);
return done(new Error('Expected error for writing to readonly file'));
}
extfs.del(parentDir, os.tmpdir(), done, ignore);
@@ -369,7 +368,7 @@ suite('Extfs', () => {
});
});
test('writeFileAndFlush (stream, error handling EISDIR)', function (done: () => void) {
test('writeFileAndFlush (stream, error handling EISDIR)', function (done) {
const id = uuid.generateUuid();
const parentDir = path.join(os.tmpdir(), 'vsctests', id);
const newDir = path.join(parentDir, 'extfs', id);
@@ -377,7 +376,7 @@ suite('Extfs', () => {
mkdirp(newDir, 493, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.ok(fs.existsSync(newDir));
@@ -387,7 +386,7 @@ suite('Extfs', () => {
const readable = toReadable('Hello World');
extfs.writeFileAndFlush(testFile, readable, null, error => {
if (!error || (<any>error).code !== 'EISDIR') {
return onError(new Error('Expected EISDIR error for writing to folder but got: ' + (error ? (<any>error).code : 'no error')), done);
return done(new Error('Expected EISDIR error for writing to folder but got: ' + (error ? (<any>error).code : 'no error')));
}
// verify that the stream is still consumable (for https://github.com/Microsoft/vscode/issues/42542)
@@ -398,7 +397,7 @@ suite('Extfs', () => {
});
});
test('writeFileAndFlush (stream, error handling READERROR)', function (done: () => void) {
test('writeFileAndFlush (stream, error handling READERROR)', function (done) {
const id = uuid.generateUuid();
const parentDir = path.join(os.tmpdir(), 'vsctests', id);
const newDir = path.join(parentDir, 'extfs', id);
@@ -406,14 +405,14 @@ suite('Extfs', () => {
mkdirp(newDir, 493, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.ok(fs.existsSync(newDir));
extfs.writeFileAndFlush(testFile, toReadable('Hello World', true /* throw error */), null, error => {
if (!error || error.message !== readError) {
return onError(new Error('Expected error for writing to folder'), done);
return done(new Error('Expected error for writing to folder'));
}
extfs.del(parentDir, os.tmpdir(), done, ignore);
@@ -421,7 +420,7 @@ suite('Extfs', () => {
});
});
test('writeFileAndFlush (stream, error handling EACCES)', function (done: () => void) {
test('writeFileAndFlush (stream, error handling EACCES)', function (done) {
if (isLinux) {
return done(); // somehow this test fails on Linux in our TFS builds
}
@@ -433,7 +432,7 @@ suite('Extfs', () => {
mkdirp(newDir, 493, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.ok(fs.existsSync(newDir));
@@ -443,7 +442,7 @@ suite('Extfs', () => {
extfs.writeFileAndFlush(testFile, toReadable('Hello World'), null, error => {
if (!error || !((<any>error).code !== 'EACCES' || (<any>error).code !== 'EPERM')) {
return onError(new Error('Expected EACCES/EPERM error for writing to folder but got: ' + (error ? (<any>error).code : 'no error')), done);
return done(new Error('Expected EACCES/EPERM error for writing to folder but got: ' + (error ? (<any>error).code : 'no error')));
}
extfs.del(parentDir, os.tmpdir(), done, ignore);
@@ -451,7 +450,7 @@ suite('Extfs', () => {
});
});
test('writeFileAndFlush (file stream, error handling)', function (done: () => void) {
test('writeFileAndFlush (file stream, error handling)', function (done) {
const id = uuid.generateUuid();
const parentDir = path.join(os.tmpdir(), 'vsctests', id);
const sourceFile = require.toUrl('./fixtures/index.html');
@@ -460,7 +459,7 @@ suite('Extfs', () => {
mkdirp(newDir, 493, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.ok(fs.existsSync(newDir));
@@ -469,7 +468,7 @@ suite('Extfs', () => {
extfs.writeFileAndFlush(testFile, fs.createReadStream(sourceFile), null, error => {
if (!error) {
return onError(new Error('Expected error for writing to folder'), done);
return done(new Error('Expected error for writing to folder'));
}
extfs.del(parentDir, os.tmpdir(), done, ignore);
@@ -477,7 +476,7 @@ suite('Extfs', () => {
});
});
test('writeFileAndFlushSync', function (done: () => void) {
test('writeFileAndFlushSync', function (done) {
const id = uuid.generateUuid();
const parentDir = path.join(os.tmpdir(), 'vsctests', id);
const newDir = path.join(parentDir, 'extfs', id);
@@ -485,7 +484,7 @@ suite('Extfs', () => {
mkdirp(newDir, 493, error => {
if (error) {
return onError(error, done);
return done(error);
}
assert.ok(fs.existsSync(newDir));