From 0dd819249db0712b96424717a19f948abca2ecb9 Mon Sep 17 00:00:00 2001 From: Nick Kreeger Date: Mon, 24 Jun 2019 19:44:01 -0700 Subject: [PATCH] Drop shelljs since it has a security issue (and no update for 6 months). (#264) * Drop shelljs since it has a security issue (and no update for 6 months). https://github.com/tensorflow/tfjs/issues/1691 * Ignore tensorboard tests (for now) on win32. * tensorboard and tensorBoard * Windows cleanup message * Add issue for reference. --- package.json | 1 - src/run_tests.ts | 9 +++++++-- src/tensorboard_test.ts | 16 ++++++++++------ yarn.lock | 21 --------------------- 4 files changed, 17 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index 3306e25f34e..76ff2f0bc74 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,6 @@ "jasmine": "~3.1.0", "node-fetch": "^2.3.0", "nyc": "^13.3.0", - "shelljs": "^0.8.3", "tmp": "^0.0.33", "ts-node": "^5.0.1", "tslint": "~5.9.1", diff --git a/src/run_tests.ts b/src/run_tests.ts index c0864179d05..a8f4b28d1af 100644 --- a/src/run_tests.ts +++ b/src/run_tests.ts @@ -59,9 +59,14 @@ const IGNORE_LIST: string[] = [ 'Reduction: argmax test-tensorflow {} 6D, axis=0' ]; -// Windows has two failing tests: -// https://github.com/tensorflow/tfjs/issues/598 if (process.platform === 'win32') { + // Ignore tensorboard on windows because tmp folder cleanup used in tests + // fails with tmp folder cleanup: + // https://github.com/tensorflow/tfjs/issues/1692 + IGNORE_LIST.push('tensorboard'); + IGNORE_LIST.push('tensorBoard'); + // Windows has two failing tests: + // https://github.com/tensorflow/tfjs/issues/598 IGNORE_LIST.push('clip test-tensorflow {} propagates NaNs'); IGNORE_LIST.push( 'maxPool test-tensorflow {} [x=[3,3,1] f=[2,2] s=1 ignores NaNs'); diff --git a/src/tensorboard_test.ts b/src/tensorboard_test.ts index d13dab40a07..ff469153144 100644 --- a/src/tensorboard_test.ts +++ b/src/tensorboard_test.ts @@ -18,13 +18,17 @@ import {scalar} from '@tensorflow/tfjs'; import * as fs from 'fs'; import * as path from 'path'; +import {promisify} from 'util'; + import * as tfn from './index'; // tslint:disable-next-line:no-require-imports -const shelljs = require('shelljs'); +const rimraf = require('rimraf'); // tslint:disable-next-line:no-require-imports const tmp = require('tmp'); +const rimrafPromise = promisify(rimraf); + describe('tensorboard', () => { let tmpLogDir: string; @@ -32,9 +36,9 @@ describe('tensorboard', () => { tmpLogDir = tmp.dirSync().name; }); - afterEach(() => { + afterEach(async () => { if (tmpLogDir != null) { - shelljs.rm('-rf', tmpLogDir); + await rimrafPromise(tmpLogDir); } }); @@ -130,7 +134,7 @@ describe('tensorboard', () => { }); it('Writing into existing directory works', () => { - shelljs.mkdir('-p', tmpLogDir); + fs.mkdirSync(tmpLogDir, {recursive: true}); const writer = tfn.node.summaryFileWriter(path.join(tmpLogDir, '22')); writer.scalar('foo', 42, 0); writer.flush(); @@ -151,9 +155,9 @@ describe('tensorBoard callback', () => { tmpLogDir = tmp.dirSync().name; }); - afterEach(() => { + afterEach(async () => { if (tmpLogDir != null) { - shelljs.rm('-rf', tmpLogDir); + await rimrafPromise(tmpLogDir); } }); diff --git a/yarn.lock b/yarn.lock index ead19e1f9b2..e4150129f43 100644 --- a/yarn.lock +++ b/yarn.lock @@ -687,11 +687,6 @@ inherits@2: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= -interpret@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296" - integrity sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw== - invert-kv@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" @@ -1318,13 +1313,6 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" -rechoir@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" - integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q= - dependencies: - resolve "^1.1.6" - release-zalgo@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/release-zalgo/-/release-zalgo-1.0.0.tgz#09700b7e5074329739330e535c5a90fb67851730" @@ -1413,15 +1401,6 @@ shebang-regex@^1.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= -shelljs@^0.8.3: - version "0.8.3" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.3.tgz#a7f3319520ebf09ee81275b2368adb286659b097" - integrity sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A== - dependencies: - glob "^7.0.0" - interpret "^1.0.0" - rechoir "^0.6.2" - signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"