You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ra...@apache.org on 2019/11/16 12:56:46 UTC
[cordova-lib] branch master updated: test: use fs.copySync for
increased performance (#826)
This is an automated email from the ASF dual-hosted git repository.
raphinesse pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-lib.git
The following commit(s) were added to refs/heads/master by this push:
new c041c89 test: use fs.copySync for increased performance (#826)
c041c89 is described below
commit c041c89f598e55d766195536375696f68bd32f22
Author: Raphael von der GrĂ¼n <ra...@gmail.com>
AuthorDate: Sat Nov 16 13:56:41 2019 +0100
test: use fs.copySync for increased performance (#826)
---
spec/fixture-helper.js | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/spec/fixture-helper.js b/spec/fixture-helper.js
index e83af61..7ee0352 100644
--- a/spec/fixture-helper.js
+++ b/spec/fixture-helper.js
@@ -57,20 +57,20 @@ module.exports = function fixtureHelper (tmpDir) {
},
// Creates a cordova project with one platform installed
- projectWithPlatform () {
+ async projectWithPlatform () {
const projectFixture = path.join(__dirname, 'cordova/fixtures/basePkgJson');
const projectPath = path.join(fixturesBaseDir, 'project-with-platform');
- return fs.copy(projectFixture, projectPath)
- .then(_ => process.chdir(projectPath))
- .then(_ => {
- // Talk about a clunky interface :(
- const platforms = ['android'];
- const opts = { platforms, save: true };
- const hooksRunner = new HooksRunner(projectPath);
- return platformAdd(hooksRunner, projectPath, platforms, opts);
- })
- .then(_ => projectPath);
+ fs.copySync(projectFixture, projectPath);
+ process.chdir(projectPath);
+
+ // Talk about a clunky interface :(
+ const platforms = ['android'];
+ const opts = { platforms, save: true };
+ const hooksRunner = new HooksRunner(projectPath);
+ await platformAdd(hooksRunner, projectPath, platforms, opts);
+
+ return projectPath;
},
androidPlatform () {
@@ -89,10 +89,10 @@ module.exports = function fixtureHelper (tmpDir) {
fixturePromises[name] = Promise.resolve(fixtureConstructors[name]());
}
return {
- copyTo (targetPath) {
- return fixturePromises[name]
- .then(fixturePath => fs.copy(fixturePath, targetPath))
- .then(_ => targetPath);
+ async copyTo (targetPath) {
+ const fixturePath = await fixturePromises[name];
+ fs.copySync(fixturePath, targetPath);
+ return targetPath;
}
};
};
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org