diff --git a/package.json b/package.json index 5d59353c..c4e7f37e 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,6 @@ "import-fresh": "^2.0.0", "is-url": "^1.2.4", "q": "^1.5.1", - "shelljs": "^0.8.2", "valid-identifier": "0.0.1" }, "devDependencies": { diff --git a/spec/create.spec.js b/spec/create.spec.js index 022601c1..280dfbe7 100644 --- a/spec/create.spec.js +++ b/spec/create.spec.js @@ -17,10 +17,10 @@ under the License. */ -var fs = require('fs'); +const fs = require('fs-extra'); + var path = require('path'); -var shell = require('shelljs'); var requireFresh = require('import-fresh'); var create = require('..'); @@ -35,12 +35,11 @@ var project = path.join(tmpDir, appName); // Setup and teardown test dirs beforeEach(function () { - shell.rm('-rf', project); - shell.mkdir('-p', tmpDir); + fs.emptyDirSync(tmpDir); }); -afterEach(function () { +afterAll(function () { process.chdir(path.join(__dirname, '..')); // Needed to rm the dir on Windows. - shell.rm('-rf', tmpDir); + fs.removeSync(tmpDir); }); describe('cordova create checks for valid-identifier', function () { @@ -342,7 +341,7 @@ describe('create end-to-end', function () { }); it('should successfully run with existing, empty destination', function () { - shell.mkdir('-p', project); + fs.ensureDirSync(project); return create(project, appId, appName, {}, events) .then(checkProjectArtifactsWithPackageFromTemplate); }); diff --git a/spec/helpers.js b/spec/helpers.js index 56d35473..ff51f6a1 100644 --- a/spec/helpers.js +++ b/spec/helpers.js @@ -17,12 +17,11 @@ under the License. */ -const fs = require('fs'); +const fs = require('fs-extra'); const os = require('os'); const path = require('path'); const rewire = require('rewire'); -const shell = require('shelljs'); // Disable regular console output during tests const CordovaLogger = require('cordova-common').CordovaLogger; @@ -44,7 +43,7 @@ function createWithMockFetch (dir, id, name, cfg, events) { const fetchSpy = jasmine.createSpy('fetchSpy') .and.callFake(() => Promise.resolve(mockFetchDest)); - shell.cp('-R', templateDir, mockFetchDest); + fs.copySync(templateDir, mockFetchDest); return createWith({fetch: fetchSpy})(dir, id, name, cfg, events) .then(() => fetchSpy); }