This is an automated email from the ASF dual-hosted git repository.
alexkli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git
The following commit(s) were added to refs/heads/master by this push:
new b4209ed remove temporary test directories after test run (#29)
b4209ed is described below
commit b4209edb7c1fe87f2289d02cbc6143808bfd77e0
Author: Alexander Klimetschek <[email protected]>
AuthorDate: Sat Mar 28 20:28:08 2020 -0700
remove temporary test directories after test run (#29)
* remove temporary test directories after test run
* create temp dirs under build/
* set chmod 755 permissions on temp dirs to work in Travis
---
package-lock.json | 6 ++++++
package.json | 1 +
test/nodejs.test.js | 25 ++++++++++++++++++++-----
3 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index d3a0705..83451a2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -529,6 +529,12 @@
"integrity":
"sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",
"dev": true
},
+ "chmodr": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/chmodr/-/chmodr-1.2.0.tgz",
+ "integrity":
"sha512-Y5uI7Iq/Az6HgJEL6pdw7THVd7jbVOTPwsmcPOBjQL8e3N+pz872kzK5QxYGEy21iRys+iHWV0UZQXDFJo1hyA==",
+ "dev": true
+ },
"chokidar": {
"version": "3.3.1",
"resolved":
"https://registry.npmjs.org/chokidar/-/chokidar-3.3.1.tgz",
diff --git a/package.json b/package.json
index d1af06d..1149666 100644
--- a/package.json
+++ b/package.json
@@ -51,6 +51,7 @@
"yargs": "^15.1.0"
},
"devDependencies": {
+ "chmodr": "^1.2.0",
"clone": "^2.1.2",
"codecov": "^3.6.5",
"eslint": "^6.8.0",
diff --git a/test/nodejs.test.js b/test/nodejs.test.js
index 1f4b419..9eb2f54 100644
--- a/test/nodejs.test.js
+++ b/test/nodejs.test.js
@@ -32,9 +32,21 @@ const test = require('./test');
const assert = require('assert');
const fse = require('fs-extra');
const fs = require('fs');
-const os = require("os");
-const path = require("path");
const sleep = require('util').promisify(setTimeout);
+const tmp = require('tmp');
+const chmodr = require('chmodr');
+
+const BUILD_DIR = "build";
+
+function makeTempDir() {
+ tmp.setGracefulCleanup();
+ fse.ensureDirSync(BUILD_DIR)
+ const tmpobj = tmp.dirSync({
+ dir: BUILD_DIR,
+ unsafeCleanup: true
+ });
+ return tmpobj.name;
+}
describe('nodejs', function() {
this.timeout(30000);
@@ -423,8 +435,9 @@ describe('nodejs', function() {
this.timeout(10000);
// create copy in temp dir so we can modify it
- const tmpDir = path.join(os.tmpdir(),
fs.mkdtempSync("wskdebug-test-"));
+ const tmpDir = makeTempDir();
fse.copySync("test/nodejs/plain-flat", tmpDir);
+ chmodr.sync(tmpDir, 0o755);
process.chdir(tmpDir);
test.mockActionDoubleInvocation(
@@ -461,8 +474,9 @@ describe('nodejs', function() {
this.timeout(10000);
// create copy in temp dir so we can modify it
- const tmpDir = path.join(os.tmpdir(),
fs.mkdtempSync("wskdebug-test-"));
+ const tmpDir = makeTempDir();
fse.copySync("test/nodejs/commonjs-flat", tmpDir);
+ chmodr.sync(tmpDir, 0o755);
process.chdir(tmpDir);
test.mockActionDoubleInvocation(
@@ -499,8 +513,9 @@ describe('nodejs', function() {
this.timeout(10000);
// create copy in temp dir so we can modify it
- const tmpDir = path.join(os.tmpdir(),
fs.mkdtempSync("wskdebug-test-"));
+ const tmpDir = makeTempDir();
fse.copySync("test/nodejs/commonjs-deps", tmpDir);
+ chmodr.sync(tmpDir, 0o755);
process.chdir(tmpDir);
test.mockActionDoubleInvocation(