mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* Update dependency del to v5 * unify del/rimraf usage with del v5 * update yarn.lock * update kbn-pm distributable * remove poorly transformed code * force some deletes from tmp * mock less of the fs module * force tmp deletion in a few more suites * please make this the last force # Conflicts: # packages/kbn-plugin-helpers/package.json
This commit is contained in:
parent
ba075e98d0
commit
4bd85e3194
42 changed files with 9987 additions and 2705 deletions
|
@ -154,7 +154,7 @@
|
|||
"custom-event-polyfill": "^0.3.0",
|
||||
"d3": "3.5.17",
|
||||
"d3-cloud": "1.2.5",
|
||||
"del": "^4.1.1",
|
||||
"del": "^5.1.0",
|
||||
"elasticsearch": "^16.4.0",
|
||||
"elasticsearch-browser": "^16.4.0",
|
||||
"encode-uri-query": "1.0.1",
|
||||
|
@ -231,7 +231,6 @@
|
|||
"request": "^2.88.0",
|
||||
"reselect": "^3.0.1",
|
||||
"resize-observer-polyfill": "^1.5.0",
|
||||
"rimraf": "2.7.1",
|
||||
"rison-node": "1.0.2",
|
||||
"rxjs": "^6.2.1",
|
||||
"script-loader": "0.7.2",
|
||||
|
@ -337,7 +336,6 @@
|
|||
"@types/redux": "^3.6.31",
|
||||
"@types/redux-actions": "^2.2.1",
|
||||
"@types/request": "^2.48.2",
|
||||
"@types/rimraf": "^2.0.2",
|
||||
"@types/selenium-webdriver": "^4.0.3",
|
||||
"@types/semver": "^5.5.0",
|
||||
"@types/sinon": "^7.0.13",
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"@kbn/babel-preset": "1.0.0",
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"@kbn/expect": "1.0.0",
|
||||
"del": "^4.1.1",
|
||||
"del": "^5.1.0",
|
||||
"getopts": "^2.2.4",
|
||||
"supports-color": "^7.0.0",
|
||||
"typescript": "3.5.3"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"abort-controller": "^2.0.3",
|
||||
"chalk": "^2.4.2",
|
||||
"dedent": "^0.7.0",
|
||||
"del": "^4.1.1",
|
||||
"del": "^5.1.0",
|
||||
"execa": "^3.2.0",
|
||||
"getopts": "^2.2.4",
|
||||
"glob": "^7.1.2",
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
"@kbn/dev-utils": "1.0.0",
|
||||
"@types/intl-relativeformat": "^2.1.0",
|
||||
"@types/react-intl": "^2.3.15",
|
||||
"del": "^4.1.1",
|
||||
"del": "^5.1.0",
|
||||
"getopts": "^2.2.4",
|
||||
"supports-color": "^6.1.0",
|
||||
"typescript": "3.5.3"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
"babel-loader": "^8.0.6",
|
||||
"copy-webpack-plugin": "^5.0.4",
|
||||
"css-loader": "2.1.1",
|
||||
"del": "^4.1.1",
|
||||
"del": "^5.1.0",
|
||||
"getopts": "^2.2.4",
|
||||
"pegjs": "0.10.0",
|
||||
"sass-loader": "^7.3.1",
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"@babel/core": "^7.5.5",
|
||||
"argv-split": "^2.0.1",
|
||||
"commander": "^2.9.0",
|
||||
"del": "^4.1.1",
|
||||
"del": "^5.1.0",
|
||||
"execa": "^3.2.0",
|
||||
"globby": "^8.0.1",
|
||||
"gulp-babel": "^8.0.0",
|
||||
|
|
12378
packages/kbn-pm/dist/index.js
vendored
12378
packages/kbn-pm/dist/index.js
vendored
File diff suppressed because one or more lines are too long
|
@ -39,7 +39,7 @@
|
|||
"cmd-shim": "^2.1.0",
|
||||
"cpy": "^7.3.0",
|
||||
"dedent": "^0.7.0",
|
||||
"del": "^4.1.1",
|
||||
"del": "^5.1.0",
|
||||
"execa": "^3.2.0",
|
||||
"getopts": "^2.2.4",
|
||||
"glob": "^7.1.2",
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import { mkdir, symlink } from 'fs';
|
||||
import { join, resolve } from 'path';
|
||||
import rmdir from 'rimraf';
|
||||
import del from 'del';
|
||||
import { promisify } from 'util';
|
||||
|
||||
import { getProjectPaths } from '../config';
|
||||
|
@ -33,20 +33,20 @@ import {
|
|||
topologicallyBatchProjects,
|
||||
} from './projects';
|
||||
|
||||
const rootPath = resolve(`${__dirname}/__fixtures__/kibana`);
|
||||
const rootPath = resolve(__dirname, '__fixtures__/kibana');
|
||||
const rootPlugins = join(rootPath, 'plugins');
|
||||
|
||||
describe('#getProjects', () => {
|
||||
beforeAll(async () => {
|
||||
await promisify(mkdir)(rootPlugins);
|
||||
|
||||
return promisify(symlink)(
|
||||
await promisify(symlink)(
|
||||
join(__dirname, '__fixtures__/symlinked-plugins/corge'),
|
||||
join(rootPlugins, 'corge')
|
||||
);
|
||||
});
|
||||
|
||||
afterAll(() => promisify(rmdir)(rootPlugins));
|
||||
afterAll(async () => await del(rootPlugins));
|
||||
|
||||
test('find all packages in the packages directory', async () => {
|
||||
const projects = await getProjects(rootPath, ['packages/*']);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"dependencies": {
|
||||
"chalk": "^2.4.2",
|
||||
"dedent": "^0.7.0",
|
||||
"del": "^4.1.1",
|
||||
"del": "^5.1.0",
|
||||
"getopts": "^2.2.4",
|
||||
"glob": "^7.1.2",
|
||||
"parse-link-header": "^1.0.1",
|
||||
|
|
|
@ -10,12 +10,13 @@
|
|||
"kbn:bootstrap": "tsc",
|
||||
"kbn:watch": "tsc --watch",
|
||||
"test": "tsd",
|
||||
"clean": "rimraf target"
|
||||
"clean": "del target"
|
||||
},
|
||||
"dependencies": {
|
||||
"utility-types": "^3.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"del-cli": "^3.0.0",
|
||||
"tsd": "^0.7.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -527,14 +527,6 @@
|
|||
'@types/request',
|
||||
],
|
||||
},
|
||||
{
|
||||
groupSlug: 'rimraf',
|
||||
groupName: 'rimraf related packages',
|
||||
packageNames: [
|
||||
'rimraf',
|
||||
'@types/rimraf',
|
||||
],
|
||||
},
|
||||
{
|
||||
groupSlug: 'selenium-webdriver',
|
||||
groupName: 'selenium-webdriver related packages',
|
||||
|
|
|
@ -21,7 +21,7 @@ import { spawn } from 'child_process';
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import os from 'os';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
|
||||
import { safeDump } from 'js-yaml';
|
||||
import { createMapStream, createSplitStream, createPromiseFromStreams } from '../../../legacy/utils/streams';
|
||||
|
@ -70,7 +70,7 @@ describe('Server logging configuration', function () {
|
|||
child = undefined;
|
||||
}
|
||||
|
||||
rimraf.sync(tempDir);
|
||||
del.sync(tempDir, { force: true });
|
||||
});
|
||||
|
||||
const isWindows = /^win/.test(process.platform);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import fs from 'fs';
|
||||
|
||||
export function cleanPrevious(settings, logger) {
|
||||
|
@ -27,7 +27,7 @@ export function cleanPrevious(settings, logger) {
|
|||
|
||||
logger.log('Found previous install attempt. Deleting...');
|
||||
try {
|
||||
rimraf.sync(settings.workingPath);
|
||||
del.sync(settings.workingPath);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
|
@ -44,8 +44,8 @@ export function cleanArtifacts(settings) {
|
|||
// delete the working directory.
|
||||
// At this point we're bailing, so swallow any errors on delete.
|
||||
try {
|
||||
rimraf.sync(settings.workingPath);
|
||||
rimraf.sync(settings.plugins[0].path);
|
||||
del.sync(settings.workingPath);
|
||||
del.sync(settings.plugins[0].path);
|
||||
}
|
||||
catch (e) {} // eslint-disable-line no-empty
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import sinon from 'sinon';
|
||||
import fs from 'fs';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
|
||||
import { cleanPrevious, cleanArtifacts } from './cleanup';
|
||||
import Logger from '../lib/logger';
|
||||
|
@ -48,11 +48,11 @@ describe('kibana cli', function () {
|
|||
logger.log.restore();
|
||||
logger.error.restore();
|
||||
fs.statSync.restore();
|
||||
rimraf.sync.restore();
|
||||
del.sync.restore();
|
||||
});
|
||||
|
||||
it('should resolve if the working path does not exist', function () {
|
||||
sinon.stub(rimraf, 'sync');
|
||||
sinon.stub(del, 'sync');
|
||||
sinon.stub(fs, 'statSync').callsFake(() => {
|
||||
const error = new Error('ENOENT');
|
||||
error.code = 'ENOENT';
|
||||
|
@ -67,7 +67,7 @@ describe('kibana cli', function () {
|
|||
});
|
||||
|
||||
it('should rethrow any exception except ENOENT from fs.statSync', function () {
|
||||
sinon.stub(rimraf, 'sync');
|
||||
sinon.stub(del, 'sync');
|
||||
sinon.stub(fs, 'statSync').throws(new Error('An Unhandled Error'));
|
||||
|
||||
errorStub = sinon.stub();
|
||||
|
@ -79,7 +79,7 @@ describe('kibana cli', function () {
|
|||
});
|
||||
|
||||
it('should log a message if there was a working directory', function () {
|
||||
sinon.stub(rimraf, 'sync');
|
||||
sinon.stub(del, 'sync');
|
||||
sinon.stub(fs, 'statSync');
|
||||
|
||||
return cleanPrevious(settings, logger)
|
||||
|
@ -89,9 +89,9 @@ describe('kibana cli', function () {
|
|||
});
|
||||
});
|
||||
|
||||
it('should rethrow any exception from rimraf.sync', function () {
|
||||
it('should rethrow any exception from del.sync', function () {
|
||||
sinon.stub(fs, 'statSync');
|
||||
sinon.stub(rimraf, 'sync').throws(new Error('I am an error thrown by rimraf'));
|
||||
sinon.stub(del, 'sync').throws(new Error('I am an error thrown by del'));
|
||||
|
||||
errorStub = sinon.stub();
|
||||
return cleanPrevious(settings, logger)
|
||||
|
@ -102,7 +102,7 @@ describe('kibana cli', function () {
|
|||
});
|
||||
|
||||
it('should resolve if the working path is deleted', function () {
|
||||
sinon.stub(rimraf, 'sync');
|
||||
sinon.stub(del, 'sync');
|
||||
sinon.stub(fs, 'statSync');
|
||||
|
||||
return cleanPrevious(settings, logger)
|
||||
|
@ -117,18 +117,18 @@ describe('kibana cli', function () {
|
|||
beforeEach(function () {});
|
||||
|
||||
afterEach(function () {
|
||||
rimraf.sync.restore();
|
||||
del.sync.restore();
|
||||
});
|
||||
|
||||
it('should attempt to delete the working directory', function () {
|
||||
sinon.stub(rimraf, 'sync');
|
||||
sinon.stub(del, 'sync');
|
||||
|
||||
cleanArtifacts(settings);
|
||||
expect(rimraf.sync.calledWith(settings.workingPath)).toBe(true);
|
||||
expect(del.sync.calledWith(settings.workingPath)).toBe(true);
|
||||
});
|
||||
|
||||
it('should swallow any errors thrown by rimraf.sync', function () {
|
||||
sinon.stub(rimraf, 'sync').throws(new Error('Something bad happened.'));
|
||||
it('should swallow any errors thrown by del.sync', function () {
|
||||
sinon.stub(del, 'sync').throws(new Error('Something bad happened.'));
|
||||
|
||||
expect(() => cleanArtifacts(settings)).not.toThrow();
|
||||
});
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import sinon from 'sinon';
|
||||
import nock from 'nock';
|
||||
import glob from 'glob-all';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import Fs from 'fs';
|
||||
import Logger from '../lib/logger';
|
||||
import { UnsupportedProtocolError } from '../lib/errors';
|
||||
|
@ -63,14 +63,14 @@ describe('kibana cli', function () {
|
|||
beforeEach(function () {
|
||||
sinon.stub(logger, 'log');
|
||||
sinon.stub(logger, 'error');
|
||||
rimraf.sync(testWorkingPath);
|
||||
del.sync(testWorkingPath);
|
||||
Fs.mkdirSync(testWorkingPath, { recursive: true });
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
logger.log.restore();
|
||||
logger.error.restore();
|
||||
rimraf.sync(testWorkingPath);
|
||||
del.sync(testWorkingPath);
|
||||
});
|
||||
|
||||
describe('_downloadSingle', function () {
|
||||
|
|
|
@ -25,7 +25,7 @@ import path from 'path';
|
|||
import { cleanPrevious, cleanArtifacts } from './cleanup';
|
||||
import { extract, getPackData } from './pack';
|
||||
import { renamePlugin } from './rename';
|
||||
import { sync as rimrafSync } from 'rimraf';
|
||||
import del from 'del';
|
||||
import { errorIfXPackInstall } from '../lib/error_if_x_pack';
|
||||
import { existingInstall, assertVersion } from './kibana';
|
||||
import { prepareExternalProjectDependencies } from '@kbn/pm';
|
||||
|
@ -46,7 +46,7 @@ export default async function install(settings, logger) {
|
|||
|
||||
await extract(settings, logger);
|
||||
|
||||
rimrafSync(settings.tempArchiveFile);
|
||||
del.sync(settings.tempArchiveFile);
|
||||
|
||||
existingInstall(settings, logger);
|
||||
|
||||
|
|
|
@ -17,19 +17,19 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
jest.mock('fs', () => ({
|
||||
statSync: jest.fn().mockImplementation(() => require('fs').statSync),
|
||||
unlinkSync: jest.fn().mockImplementation(() => require('fs').unlinkSync),
|
||||
mkdirSync: jest.fn().mockImplementation(() => require('fs').mkdirSync),
|
||||
}));
|
||||
|
||||
import sinon from 'sinon';
|
||||
import Logger from '../lib/logger';
|
||||
import { join } from 'path';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import fs from 'fs';
|
||||
import { existingInstall, assertVersion } from './kibana';
|
||||
|
||||
jest.spyOn(fs, 'statSync');
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('kibana cli', function () {
|
||||
|
||||
describe('plugin installer', function () {
|
||||
|
@ -53,7 +53,7 @@ describe('kibana cli', function () {
|
|||
describe('assertVersion', function () {
|
||||
|
||||
beforeEach(function () {
|
||||
rimraf.sync(testWorkingPath);
|
||||
del.sync(testWorkingPath);
|
||||
fs.mkdirSync(testWorkingPath, { recursive: true });
|
||||
sinon.stub(logger, 'log');
|
||||
sinon.stub(logger, 'error');
|
||||
|
@ -62,7 +62,7 @@ describe('kibana cli', function () {
|
|||
afterEach(function () {
|
||||
logger.log.restore();
|
||||
logger.error.restore();
|
||||
rimraf.sync(testWorkingPath);
|
||||
del.sync(testWorkingPath);
|
||||
});
|
||||
|
||||
it('should succeed with exact match', function () {
|
||||
|
@ -124,14 +124,14 @@ describe('kibana cli', function () {
|
|||
});
|
||||
|
||||
it('should throw an error if the plugin already exists.', function () {
|
||||
fs.statSync = jest.fn().mockImplementationOnce(() => true);
|
||||
fs.statSync.mockImplementationOnce(() => true);
|
||||
existingInstall(settings, logger);
|
||||
expect(logger.error.firstCall.args[0]).toMatch(/already exists/);
|
||||
expect(process.exit.called).toBe(true);
|
||||
});
|
||||
|
||||
it('should not throw an error if the plugin does not exist.', function () {
|
||||
fs.statSync = jest.fn().mockImplementationOnce(() => {
|
||||
fs.statSync.mockImplementationOnce(() => {
|
||||
throw { code: 'ENOENT' };
|
||||
});
|
||||
existingInstall(settings, logger);
|
||||
|
|
|
@ -21,7 +21,7 @@ import Fs from 'fs';
|
|||
|
||||
import sinon from 'sinon';
|
||||
import glob from 'glob-all';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import Logger from '../lib/logger';
|
||||
import { extract, getPackData } from './pack';
|
||||
import { _downloadSingle } from './download';
|
||||
|
@ -41,7 +41,7 @@ describe('kibana cli', function () {
|
|||
|
||||
beforeEach(function () {
|
||||
//These tests are dependent on the file system, and I had some inconsistent
|
||||
//behavior with rimraf.sync show up. Until these tests are re-written to not
|
||||
//behavior with del.sync show up. Until these tests are re-written to not
|
||||
//depend on the file system, I make sure that each test uses a different
|
||||
//working directory.
|
||||
testNum += 1;
|
||||
|
@ -65,7 +65,7 @@ describe('kibana cli', function () {
|
|||
afterEach(function () {
|
||||
logger.log.restore();
|
||||
logger.error.restore();
|
||||
rimraf.sync(workingPathRoot);
|
||||
del.sync(workingPathRoot);
|
||||
});
|
||||
|
||||
function copyReplyFile(filename) {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import path from 'path';
|
||||
import os from 'os';
|
||||
import glob from 'glob';
|
||||
|
@ -38,7 +38,7 @@ describe('kibana cli', function () {
|
|||
});
|
||||
|
||||
afterEach(() => {
|
||||
rimraf.sync(tempPath);
|
||||
del.sync(tempPath, { force: true });
|
||||
});
|
||||
|
||||
describe('analyzeArchive', function () {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import sinon from 'sinon';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import Logger from '../lib/logger';
|
||||
import list from './list';
|
||||
import { join } from 'path';
|
||||
|
@ -46,14 +46,14 @@ describe('kibana cli', function () {
|
|||
logger = new Logger(settings);
|
||||
sinon.stub(logger, 'log');
|
||||
sinon.stub(logger, 'error');
|
||||
rimraf.sync(pluginDir);
|
||||
del.sync(pluginDir);
|
||||
mkdirSync(pluginDir, { recursive: true });
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
logger.log.restore();
|
||||
logger.error.restore();
|
||||
rimraf.sync(pluginDir);
|
||||
del.sync(pluginDir);
|
||||
});
|
||||
|
||||
it('list all of the folders in the plugin folder', function () {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import { statSync } from 'fs';
|
||||
import { errorIfXPackRemove } from '../lib/error_if_x_pack';
|
||||
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
|
||||
export default function remove(settings, logger) {
|
||||
try {
|
||||
|
@ -37,7 +37,7 @@ export default function remove(settings, logger) {
|
|||
}
|
||||
|
||||
logger.log(`Removing ${settings.plugin}...`);
|
||||
rimraf.sync(settings.pluginPath);
|
||||
del.sync(settings.pluginPath);
|
||||
logger.log('Plugin removal complete');
|
||||
} catch (err) {
|
||||
logger.error(`Unable to remove plugin because of error: "${err.message}"`);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import sinon from 'sinon';
|
||||
import glob from 'glob-all';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import Logger from '../lib/logger';
|
||||
import remove from './remove';
|
||||
import { join } from 'path';
|
||||
|
@ -40,7 +40,7 @@ describe('kibana cli', function () {
|
|||
logger = new Logger(settings);
|
||||
sinon.stub(logger, 'log');
|
||||
sinon.stub(logger, 'error');
|
||||
rimraf.sync(pluginDir);
|
||||
del.sync(pluginDir);
|
||||
mkdirSync(pluginDir, { recursive: true });
|
||||
});
|
||||
|
||||
|
@ -48,7 +48,7 @@ describe('kibana cli', function () {
|
|||
processExitStub.restore();
|
||||
logger.log.restore();
|
||||
logger.error.restore();
|
||||
rimraf.sync(pluginDir);
|
||||
del.sync(pluginDir);
|
||||
});
|
||||
|
||||
it('throw an error if the plugin is not installed.', function () {
|
||||
|
|
|
@ -25,13 +25,12 @@ import fs from 'fs';
|
|||
import webpack from 'webpack';
|
||||
import { promisify } from 'util';
|
||||
import path from 'path';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
|
||||
const readFileAsync = promisify(fs.readFile);
|
||||
const mkdirAsync = promisify(fs.mkdir);
|
||||
const existsAsync = promisify(fs.exists);
|
||||
const writeFileAsync = promisify(fs.writeFile);
|
||||
const rimrafAsync = promisify(rimraf);
|
||||
|
||||
export class DllCompiler {
|
||||
static getRawDllConfig(uiBundles = {}, babelLoaderCacheDir = '', threadLoaderPoolConfig = {}) {
|
||||
|
@ -267,7 +266,7 @@ export class DllCompiler {
|
|||
// Delete the built dll, as it contains invalid modules, and reject listing
|
||||
// all the not allowed modules
|
||||
try {
|
||||
await rimrafAsync(this.rawDllConfig.outputPath);
|
||||
await del(this.rawDllConfig.outputPath);
|
||||
} catch (e) {
|
||||
return reject(e);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import { join } from 'path';
|
||||
import { execFileSync as exec } from 'child_process';
|
||||
|
||||
|
@ -46,7 +46,7 @@ export default function (grunt) {
|
|||
], { env })).trim();
|
||||
|
||||
grunt.log.write('Clearing old docs ... ');
|
||||
rimraf.sync(htmlDocsDir);
|
||||
del.sync(htmlDocsDir);
|
||||
grunt.log.writeln('done');
|
||||
|
||||
grunt.log.write('Copying new docs ... ');
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import assert from 'assert';
|
||||
import { delay } from 'bluebird';
|
||||
import path from 'path';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import sinon from 'sinon';
|
||||
import { prepareProjectByCloning as prepareProject } from '../test_utils';
|
||||
import { CloneWorkerResult, Repository } from '../../model';
|
||||
|
@ -28,18 +28,14 @@ const esQueue = {};
|
|||
const serverOptions = createTestServerOption();
|
||||
const gitOps = new GitOperations(serverOptions.repoPath);
|
||||
|
||||
function cleanWorkspace() {
|
||||
return new Promise(resolve => {
|
||||
rimraf(serverOptions.workspacePath, resolve);
|
||||
});
|
||||
async function cleanWorkspace() {
|
||||
await del(serverOptions.workspacePath);
|
||||
}
|
||||
|
||||
describe('clone_worker_tests', () => {
|
||||
// @ts-ignore
|
||||
before(async () => {
|
||||
return new Promise(resolve => {
|
||||
rimraf(serverOptions.repoPath, resolve);
|
||||
});
|
||||
await del(serverOptions.repoPath);
|
||||
});
|
||||
|
||||
beforeEach(async function() {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import assert from 'assert';
|
||||
import path from 'path';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import sinon from 'sinon';
|
||||
import { prepareProjectByCloning as prepareProject } from '../test_utils';
|
||||
import { GitOperations } from '../git_operations';
|
||||
|
@ -36,10 +36,8 @@ const repoUri = 'github.com/elastic/TypeScript-Node-Starter';
|
|||
const serverOptions = createTestServerOption();
|
||||
const gitOps = new GitOperations(serverOptions.repoPath);
|
||||
|
||||
function cleanWorkspace() {
|
||||
return new Promise(resolve => {
|
||||
rimraf(serverOptions.workspacePath, resolve);
|
||||
});
|
||||
async function cleanWorkspace() {
|
||||
await del(serverOptions.workspacePath);
|
||||
}
|
||||
|
||||
function setupEsClientSpy() {
|
||||
|
@ -84,9 +82,7 @@ describe('Commit indexer unit tests', function(this: any) {
|
|||
|
||||
// @ts-ignore
|
||||
before(async () => {
|
||||
return new Promise(resolve => {
|
||||
rimraf(serverOptions.repoPath, resolve);
|
||||
});
|
||||
await del(serverOptions.repoPath);
|
||||
});
|
||||
|
||||
beforeEach(async function() {
|
||||
|
|
|
@ -9,7 +9,7 @@ import assert from 'assert';
|
|||
import { execSync } from 'child_process';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import { GitOperations } from '../git_operations';
|
||||
import { createTestServerOption } from '../test_utils';
|
||||
import { prepareProjectByCloning as cloneProject, prepareProjectByInit } from '../test_utils';
|
||||
|
@ -40,7 +40,7 @@ describe('git_operations', () => {
|
|||
const headCommit = await g.getCommitInfo(repoUri, 'HEAD');
|
||||
assert.strictEqual(headRevision, headCommit!.id);
|
||||
} finally {
|
||||
rimraf.sync(repoDir);
|
||||
del.sync(repoDir);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import assert from 'assert';
|
||||
import path from 'path';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import sinon from 'sinon';
|
||||
|
||||
import { DiffKind } from '../../common/git_diff';
|
||||
|
@ -42,10 +42,8 @@ const serverOptions = createTestServerOption();
|
|||
const server = createTestHapiServer();
|
||||
const gitOps = new GitOperations(serverOptions.repoPath);
|
||||
|
||||
function cleanWorkspace() {
|
||||
return new Promise(resolve => {
|
||||
rimraf(serverOptions.workspacePath, resolve);
|
||||
});
|
||||
async function cleanWorkspace() {
|
||||
await del(serverOptions.workspacePath);
|
||||
}
|
||||
|
||||
function setupEsClientSpy() {
|
||||
|
@ -109,9 +107,7 @@ function setupLsServiceSendRequestSpy(): sinon.SinonSpy {
|
|||
describe('LSP incremental indexer unit tests', () => {
|
||||
// @ts-ignore
|
||||
before(async () => {
|
||||
return new Promise(resolve => {
|
||||
rimraf(serverOptions.repoPath, resolve);
|
||||
});
|
||||
await del(serverOptions.repoPath);
|
||||
});
|
||||
|
||||
beforeEach(async function() {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import assert from 'assert';
|
||||
import path from 'path';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import sinon from 'sinon';
|
||||
import { prepareProjectByCloning as prepareProject } from '../test_utils';
|
||||
|
||||
|
@ -41,10 +41,8 @@ const serverOptions = createTestServerOption();
|
|||
const server = createTestHapiServer();
|
||||
const gitOps = new GitOperations(serverOptions.repoPath);
|
||||
|
||||
function cleanWorkspace() {
|
||||
return new Promise(resolve => {
|
||||
rimraf(serverOptions.workspacePath, resolve);
|
||||
});
|
||||
async function cleanWorkspace() {
|
||||
await del(serverOptions.workspacePath);
|
||||
}
|
||||
|
||||
function setupEsClientSpy() {
|
||||
|
@ -110,22 +108,18 @@ describe('LSP indexer unit tests', function(this: any) {
|
|||
|
||||
// @ts-ignore
|
||||
before(async () => {
|
||||
return new Promise(resolve => {
|
||||
rimraf(serverOptions.repoPath, resolve);
|
||||
});
|
||||
await del(serverOptions.repoPath);
|
||||
});
|
||||
|
||||
beforeEach(async function() {
|
||||
// @ts-ignore
|
||||
this.timeout(200000);
|
||||
return await prepareProject(
|
||||
`https://${repoUri}.git`,
|
||||
path.join(serverOptions.repoPath, repoUri)
|
||||
);
|
||||
await prepareProject(`https://${repoUri}.git`, path.join(serverOptions.repoPath, repoUri));
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
after(() => {
|
||||
return cleanWorkspace();
|
||||
after(async () => {
|
||||
await cleanWorkspace();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
|
|
@ -9,7 +9,7 @@ import assert from 'assert';
|
|||
import fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import path from 'path';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import { RepositoryUtils } from '../../common/repository_utils';
|
||||
import { RepositoryService } from '../repository_service';
|
||||
import { ConsoleLogger } from '../utils/console_logger';
|
||||
|
@ -26,8 +26,9 @@ describe('repository service test', () => {
|
|||
});
|
||||
// @ts-ignore
|
||||
after(() => {
|
||||
return rimraf.sync(baseDir);
|
||||
del.sync(baseDir);
|
||||
});
|
||||
|
||||
const service = new RepositoryService(repoDir, credsDir, log);
|
||||
|
||||
it('can not clone a repo by ssh without a key', async () => {
|
||||
|
|
|
@ -8,7 +8,7 @@ import path from 'path';
|
|||
|
||||
import assert from 'assert';
|
||||
import * as os from 'os';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import { ResponseMessage } from 'vscode-jsonrpc/lib/messages';
|
||||
|
||||
import { LspRequest } from '../../model';
|
||||
|
@ -163,6 +163,6 @@ describe('workspace_handler tests', () => {
|
|||
|
||||
// @ts-ignore
|
||||
after(() => {
|
||||
rimraf.sync(baseDir);
|
||||
del.sync(baseDir);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import path from 'path';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import sinon from 'sinon';
|
||||
|
||||
import { LanguageServerStatus } from '../../common/language_server';
|
||||
|
@ -109,7 +109,7 @@ beforeEach(async () => {
|
|||
);
|
||||
});
|
||||
afterAll(() => {
|
||||
rimraf.sync(baseDir);
|
||||
del.sync(baseDir, { force: true });
|
||||
});
|
||||
|
||||
function mockRequest(repo: string, file: string) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import fs from 'fs';
|
|||
import { Server } from 'hapi';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
|
||||
import { LanguageServers } from './language_servers';
|
||||
import { InstallManager } from './install_manager';
|
||||
|
@ -46,7 +46,7 @@ beforeAll(() => {
|
|||
});
|
||||
|
||||
afterAll(() => {
|
||||
rimraf.sync(fakeTestDir);
|
||||
del.sync(fakeTestDir, { force: true });
|
||||
});
|
||||
|
||||
test('install language server by plugin', async () => {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import fs from 'fs';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import sinon from 'sinon';
|
||||
import { pathToFileURL } from 'url';
|
||||
|
||||
|
@ -25,10 +25,8 @@ beforeEach(async () => {
|
|||
}
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
return new Promise(resolve => {
|
||||
rimraf(options.workspacePath, resolve);
|
||||
});
|
||||
afterEach(async () => {
|
||||
await del(options.workspacePath, { force: true });
|
||||
});
|
||||
|
||||
function createMockProxy(initDelay: number = 0, requestDelay: number = 0) {
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
/* eslint-disable no-console */
|
||||
|
||||
import fs from 'fs';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
|
||||
import { TestConfig, Repo } from '../../model/test_config';
|
||||
import { prepareProjectByCloning } from '../test_utils';
|
||||
|
@ -25,19 +24,15 @@ export class TestRepoManager {
|
|||
}
|
||||
|
||||
public async cleanAllRepos() {
|
||||
this.repos.forEach(repo => {
|
||||
this.cleanRepo(repo.path);
|
||||
});
|
||||
for (const repo of this.repos) {
|
||||
await this.cleanRepo(repo.path);
|
||||
}
|
||||
}
|
||||
|
||||
public async cleanRepo(path: string) {
|
||||
return new Promise(resolve => {
|
||||
if (fs.existsSync(path)) {
|
||||
rimraf(path, resolve);
|
||||
} else {
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
private async cleanRepo(path: string) {
|
||||
if (fs.existsSync(path)) {
|
||||
await del(path);
|
||||
}
|
||||
}
|
||||
|
||||
public getRepo(language: string): Repo {
|
||||
|
|
|
@ -7,7 +7,7 @@ import fs from 'fs';
|
|||
import path from 'path';
|
||||
|
||||
import * as os from 'os';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import { ResponseMessage } from 'vscode-jsonrpc/lib/messages';
|
||||
|
||||
import { LspRequest } from '../../model';
|
||||
|
@ -143,5 +143,5 @@ beforeAll(() => {
|
|||
});
|
||||
|
||||
afterAll(() => {
|
||||
rimraf.sync(baseDir);
|
||||
del.sync(baseDir, { force: true });
|
||||
});
|
||||
|
|
|
@ -10,23 +10,20 @@ import * as os from 'os';
|
|||
import path from 'path';
|
||||
|
||||
import { simplegit } from '@elastic/simple-git/dist';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import { AnyObject } from './lib/esqueue';
|
||||
import { ServerOptions } from './server_options';
|
||||
import { ServerFacade } from '..';
|
||||
|
||||
export function prepareProjectByCloning(url: string, p: string) {
|
||||
return new Promise(resolve => {
|
||||
if (!fs.existsSync(p)) {
|
||||
rimraf(p, error => {
|
||||
fs.mkdirSync(p, { recursive: true });
|
||||
const git = simplegit(p);
|
||||
git.clone(url, p, ['--bare']).then(resolve);
|
||||
});
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
export async function prepareProjectByCloning(url: string, p: string) {
|
||||
if (fs.existsSync(p)) {
|
||||
return;
|
||||
}
|
||||
|
||||
await del(p);
|
||||
fs.mkdirSync(p, { recursive: true });
|
||||
const git = simplegit(p);
|
||||
return await git.clone(url, p, ['--bare']);
|
||||
}
|
||||
|
||||
export async function prepareProjectByInit(
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
ConsoleMessage,
|
||||
Request as PuppeteerRequest,
|
||||
} from 'puppeteer';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
import * as Rx from 'rxjs';
|
||||
import { ignoreElements, mergeMap, tap } from 'rxjs/operators';
|
||||
import { InnerSubscriber } from 'rxjs/internal/InnerSubscriber';
|
||||
|
@ -166,12 +166,8 @@ export class HeadlessChromiumDriverFactory {
|
|||
this.logger.debug(`deleting chromium user data directory at [${userDataDir}]`);
|
||||
// the unsubscribe function isn't `async` so we're going to make our best effort at
|
||||
// deleting the userDataDir and if it fails log an error.
|
||||
rimraf(userDataDir, err => {
|
||||
if (err) {
|
||||
return this.logger.error(
|
||||
`error deleting user data directory at [${userDataDir}]: [${err}]`
|
||||
);
|
||||
}
|
||||
del(userDataDir).catch(error => {
|
||||
this.logger.error(`error deleting user data directory at [${userDataDir}]: [${error}]`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
import { readdirSync } from 'fs';
|
||||
import { resolve as resolvePath } from 'path';
|
||||
|
||||
import { fromNode as fcb } from 'bluebird';
|
||||
import rimraf from 'rimraf';
|
||||
import del from 'del';
|
||||
|
||||
import { log, asyncMap } from './util';
|
||||
|
||||
|
@ -32,7 +31,7 @@ export async function clean(dir: string, expectedPaths: string[]) {
|
|||
const path = resolvePath(dir, filename);
|
||||
if (!expectedPaths.includes(path)) {
|
||||
log(`Deleting unexpected file ${path}`);
|
||||
await fcb(cb => rimraf(path, cb));
|
||||
await del(path);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -98,7 +98,6 @@
|
|||
"@types/recompose": "^0.30.6",
|
||||
"@types/reduce-reducers": "^0.3.0",
|
||||
"@types/redux-actions": "^2.2.1",
|
||||
"@types/rimraf": "^2.0.2",
|
||||
"@types/sinon": "^7.0.13",
|
||||
"@types/storybook__addon-actions": "^3.4.3",
|
||||
"@types/storybook__addon-info": "^4.1.2",
|
||||
|
@ -128,7 +127,6 @@
|
|||
"commander": "2.20.0",
|
||||
"copy-webpack-plugin": "^5.0.4",
|
||||
"cypress": "^3.4.1",
|
||||
"del": "^4.1.1",
|
||||
"enzyme": "^3.10.0",
|
||||
"enzyme-adapter-react-16": "^1.14.0",
|
||||
"enzyme-adapter-utils": "^1.12.0",
|
||||
|
@ -244,6 +242,7 @@
|
|||
"d3-scale": "1.0.7",
|
||||
"dataloader": "^1.4.0",
|
||||
"dedent": "^0.7.0",
|
||||
"del": "^5.1.0",
|
||||
"dragselect": "1.13.1",
|
||||
"elasticsearch": "^16.4.0",
|
||||
"extract-zip": "1.6.7",
|
||||
|
@ -350,7 +349,6 @@
|
|||
"request": "^2.88.0",
|
||||
"reselect": "3.0.1",
|
||||
"resize-observer-polyfill": "^1.5.0",
|
||||
"rimraf": "^2.7.1",
|
||||
"rison-node": "0.3.1",
|
||||
"rxjs": "^6.2.1",
|
||||
"semver": "5.7.0",
|
||||
|
|
18
yarn.lock
18
yarn.lock
|
@ -3957,14 +3957,6 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.10.2.tgz#bd1740c4ad51966609b058803ee6874577848b37"
|
||||
integrity sha512-LqJkY4VQ7S09XhI7kA3ON71AxauROhSv74639VsNXC9ish4IWHnIi98if+nP1MxQV3RMPqXSCYgpPsDHjlg9UQ==
|
||||
|
||||
"@types/rimraf@^2.0.2":
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/rimraf/-/rimraf-2.0.2.tgz#7f0fc3cf0ff0ad2a99bb723ae1764f30acaf8b6e"
|
||||
integrity sha512-Hm/bnWq0TCy7jmjeN5bKYij9vw5GrDFWME4IuxV08278NtU/VdGbzsBohcCUJ7+QMqmUq5hpRKB39HeQWJjztQ==
|
||||
dependencies:
|
||||
"@types/glob" "*"
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/selenium-webdriver@^4.0.3":
|
||||
version "4.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/selenium-webdriver/-/selenium-webdriver-4.0.3.tgz#388f12c464cc1fff5d4c84cb372f19b9ab9b5c81"
|
||||
|
@ -9938,6 +9930,14 @@ defined@~1.0.0:
|
|||
resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693"
|
||||
integrity sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=
|
||||
|
||||
del-cli@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/del-cli/-/del-cli-3.0.0.tgz#327a15d4c18d6b7e5c849a53ef0d17901bc28197"
|
||||
integrity sha512-J4HDC2mpcN5aopya4VdkyiFXZaqAoo7ua9VpKbciX3DDUSbtJbPMc3ivggJsAAgS6EqonmbenIiMhBGtJPW9FA==
|
||||
dependencies:
|
||||
del "^5.1.0"
|
||||
meow "^5.0.0"
|
||||
|
||||
del@^2.0.2:
|
||||
version "2.2.2"
|
||||
resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8"
|
||||
|
@ -24674,7 +24674,7 @@ rimraf@2.6.3, rimraf@^2.6.3, rimraf@~2.6.2:
|
|||
dependencies:
|
||||
glob "^7.1.3"
|
||||
|
||||
rimraf@2.7.1, rimraf@^2.7.1:
|
||||
rimraf@^2.7.1:
|
||||
version "2.7.1"
|
||||
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec"
|
||||
integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue