You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2019/02/28 02:11:54 UTC

[cordova-windows] branch master updated: Change Temporary Directories for Tests (#324)

This is an automated email from the ASF dual-hosted git repository.

erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git


The following commit(s) were added to refs/heads/master by this push:
     new 33a931a  Change Temporary Directories for Tests (#324)
33a931a is described below

commit 33a931a874270b7478cbf814a83faae90f13a46c
Author: Ken Naito <fi...@gmail.com>
AuthorDate: Thu Feb 28 11:11:50 2019 +0900

    Change Temporary Directories for Tests (#324)
---
 .gitignore                |  3 ++-
 package.json              |  1 +
 spec/e2e/endtoend.spec.js | 28 ++++++++++++++++------------
 template/cordova/prepare  |  2 +-
 4 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/.gitignore b/.gitignore
index b0483e3..df6b64d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,4 +17,5 @@ npm-debug.log
 coverage/*
 testcreate*
 coverage/
-.nyc_output/
\ No newline at end of file
+.nyc_output/
+temp/*
diff --git a/package.json b/package.json
index e7fea35..23207d6 100644
--- a/package.json
+++ b/package.json
@@ -41,6 +41,7 @@
     "eslint-plugin-node": "^8.0.1",
     "eslint-plugin-promise": "^4.0.1",
     "eslint-plugin-standard": "^4.0.0",
+    "fs-extra": "^7.0.1",
     "jasmine": "3.1.0",
     "nyc": "^13.1.0",
     "rewire": "^4.0.1"
diff --git a/spec/e2e/endtoend.spec.js b/spec/e2e/endtoend.spec.js
index 6917605..f5a70d8 100644
--- a/spec/e2e/endtoend.spec.js
+++ b/spec/e2e/endtoend.spec.js
@@ -17,7 +17,7 @@
     under the License.
 */
 var shell = require('shelljs');
-var fs = require('fs');
+var fs = require('fs-extra');
 var path = require('path');
 
 var FIXTURES = path.join(__dirname, '../unit/fixtures');
@@ -30,8 +30,10 @@ var PluginInfo = require('cordova-common').PluginInfo;
 
 describe('Cordova create and build', function () {
 
+    var templateDir = path.join(__dirname, '../../template');
     var projectFolder = 'testcreate 応用';
-    var buildDirectory = path.join(__dirname, '../..');
+    var workingDirectory = path.join(__dirname, '../../temp');
+    var buildDirectory = path.join(workingDirectory, 'platforms');
     var appPackagesFolder = path.join(buildDirectory, projectFolder, 'AppPackages');
     var buildScriptPath = '"' + path.join(buildDirectory, projectFolder, 'cordova', 'build') + '"';
     var prepareScriptPath = '"' + path.join(buildDirectory, projectFolder, 'cordova', 'prepare') + '"';
@@ -61,17 +63,19 @@ describe('Cordova create and build', function () {
     }
 
     beforeEach(function () {
-        shell.exec(path.join('bin', 'create') + ' "' + projectFolder + '" com.test.app 応用', { silent: silent });
+        fs.ensureDirSync(buildDirectory);
+        fs.copySync(path.join(templateDir, 'www'), path.join(workingDirectory, 'www'));
+        fs.copySync(path.join(templateDir, 'config.xml'), path.join(workingDirectory, 'config.xml'));
+        shell.exec(path.join('bin', 'create') + ' "' + path.join(buildDirectory, projectFolder) + '" com.test.app 応用', { silent: silent });
         shell.exec(prepareScriptPath + '', { silent: silent });
     });
 
     afterEach(function () {
-        shell.cd(buildDirectory);
-        shell.rm('-rf', projectFolder);
+        fs.removeSync(workingDirectory);
     });
 
     it('spec.1 should create new project', function () {
-        expect(fs.existsSync(projectFolder)).toBe(true);
+        expect(fs.existsSync(path.join(buildDirectory, projectFolder))).toBe(true);
     });
 
     // default
@@ -159,9 +163,9 @@ describe('Cordova create and build', function () {
 
         extensionsPluginInfo = new PluginInfo(extensionsPlugin);
         api = new Api();
-        api.root = projectFolder;
-        api.locations.root = projectFolder;
-        api.locations.www = path.join(projectFolder, 'www');
+        api.root = path.join(buildDirectory, projectFolder);
+        api.locations.root = path.join(buildDirectory, projectFolder);
+        api.locations.www = path.join(buildDirectory, projectFolder, 'www');
 
         var fail = jasmine.createSpy('fail')
             .and.callFake(function (err) {
@@ -185,9 +189,9 @@ describe('Cordova create and build', function () {
 
         extensionsPluginInfo = new PluginInfo(extensionsPlugin);
         api = new Api();
-        api.root = projectFolder;
-        api.locations.root = projectFolder;
-        api.locations.www = path.join(projectFolder, 'www');
+        api.root = path.join(buildDirectory, projectFolder);
+        api.locations.root = path.join(buildDirectory, projectFolder);
+        api.locations.www = path.join(buildDirectory, projectFolder, 'www');
 
         var fail = jasmine.createSpy('fail')
             .and.callFake(function (err) {
diff --git a/template/cordova/prepare b/template/cordova/prepare
index e919b77..2bbd0b5 100644
--- a/template/cordova/prepare
+++ b/template/cordova/prepare
@@ -44,7 +44,7 @@ opts.noPrepare = true;
 
 require('./lib/loggingHelper').adjustLoggerLevel(opts);
 
-var projectRoot = path.join(__dirname, '..');
+var projectRoot = path.join(__dirname, '../../..');
 var project = {
     root: projectRoot,
     projectConfig: new ConfigParser(path.join(projectRoot, 'config.xml')),


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org