You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by al...@apache.org on 2020/03/28 04:42:00 UTC
[openwhisk-wskdebug] 01/01: remove temporary test directories after
test run
This is an automated email from the ASF dual-hosted git repository.
alexkli pushed a commit to branch cleanup-tmpdir
in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git
commit 8348efeac8ff4243360ec2d95946d778ce067104
Author: Alexander Klimetschek <ak...@adobe.com>
AuthorDate: Fri Mar 27 21:41:32 2020 -0700
remove temporary test directories after test run
---
test/nodejs.test.js | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/test/nodejs.test.js b/test/nodejs.test.js
index 1f4b419..39462f3 100644
--- a/test/nodejs.test.js
+++ b/test/nodejs.test.js
@@ -32,9 +32,15 @@ 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');
+
+function makeTempDir() {
+ tmp.setGracefulCleanup();
+ const tmpobj = tmp.dirSync({ unsafeCleanup: true });
+ console.log('temp dir: ', tmpobj.name);
+ return tmpobj.name;
+}
describe('nodejs', function() {
this.timeout(30000);
@@ -423,7 +429,7 @@ 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);
process.chdir(tmpDir);
@@ -461,7 +467,7 @@ 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);
process.chdir(tmpDir);
@@ -499,7 +505,7 @@ 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);
process.chdir(tmpDir);