diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 30963d12..8e32971e 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -2512,11 +2512,6 @@ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", "dev": true }, - "file-exists": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-exists/-/file-exists-1.0.0.tgz", - "dev": true - }, "file-name": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/file-name/-/file-name-0.1.0.tgz", diff --git a/package.json b/package.json index c1f24d10..01e17ca4 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,6 @@ "eslint-plugin-node": "6.0.0", "eslint-plugin-promise": "3.6.0", "eslint-plugin-standard": "3.0.1", - "file-exists": "1.0.0", "html-angular-validate": "0.1.9", "mocha": "3.2.0", "mochainon": "1.0.0", diff --git a/tests/image-stream/tester.js b/tests/image-stream/tester.js index c280116b..beb1e054 100644 --- a/tests/image-stream/tester.js +++ b/tests/image-stream/tester.js @@ -19,8 +19,7 @@ const m = require('mochainon') const _ = require('lodash') const Bluebird = require('bluebird') -const fileExists = require('file-exists') -const fs = Bluebird.promisifyAll(require('fs')) +const fs = require('fs') const os = require('os') const path = require('path') const imageStream = require('../../lib/image-stream/index') @@ -35,9 +34,14 @@ const doFilesContainTheSameData = (file1, file2) => { } const deleteIfExists = (file) => { - return Bluebird.try(function () { - if (fileExists(file)) { - return fs.unlinkAsync(file) + return Bluebird.try(() => { + try { + fs.accessSync(file) + fs.unlinkSync(file) + } catch (error) { + if (error.code !== 'ENOENT') { + return Bluebird.reject(error) + } } return Bluebird.resolve()