testcafe-browser-tools
Advanced tools
Comparing version 1.4.1 to 1.4.2
@@ -56,4 +56,8 @@ 'use strict'; | ||
case 0: | ||
if (_utilsEnsureDirectory2.default(thumbnailPath)) { | ||
context$2$0.next = 2; | ||
context$2$0.next = 2; | ||
return _regeneratorRuntime.awrap(_utilsEnsureDirectory2.default(thumbnailPath)); | ||
case 2: | ||
if (context$2$0.sent) { | ||
context$2$0.next = 4; | ||
break; | ||
@@ -64,7 +68,7 @@ } | ||
case 2: | ||
context$2$0.next = 4; | ||
case 4: | ||
context$2$0.next = 6; | ||
return _regeneratorRuntime.awrap(_utilsExec.execFile(_binaries2.default.generateThumbnail, [sourcePath, thumbnailPath, width, height])); | ||
case 4: | ||
case 6: | ||
case 'end': | ||
@@ -71,0 +75,0 @@ return context$2$0.stop(); |
@@ -41,4 +41,8 @@ 'use strict'; | ||
case 0: | ||
if (_utilsEnsureDirectory2.default(screenshotPath)) { | ||
context$1$0.next = 2; | ||
context$1$0.next = 2; | ||
return _regeneratorRuntime.awrap(_utilsEnsureDirectory2.default(screenshotPath)); | ||
case 2: | ||
if (context$1$0.sent) { | ||
context$1$0.next = 4; | ||
break; | ||
@@ -49,24 +53,24 @@ } | ||
case 2: | ||
case 4: | ||
if (!(typeof windowDescriptor === 'string')) { | ||
context$1$0.next = 8; | ||
context$1$0.next = 10; | ||
break; | ||
} | ||
context$1$0.next = 5; | ||
context$1$0.next = 7; | ||
return _regeneratorRuntime.awrap(_findWindow2.default(windowDescriptor)); | ||
case 5: | ||
case 7: | ||
context$1$0.t0 = context$1$0.sent; | ||
context$1$0.next = 9; | ||
context$1$0.next = 11; | ||
break; | ||
case 8: | ||
case 10: | ||
context$1$0.t0 = windowDescriptor; | ||
case 9: | ||
case 11: | ||
windowDescription = context$1$0.t0; | ||
if (windowDescription) { | ||
context$1$0.next = 12; | ||
context$1$0.next = 14; | ||
break; | ||
@@ -77,3 +81,3 @@ } | ||
case 12: | ||
case 14: | ||
screenshotArguments = void 0; | ||
@@ -83,6 +87,6 @@ | ||
context$1$0.next = 16; | ||
context$1$0.next = 18; | ||
return _regeneratorRuntime.awrap(_utilsExec.execFile(_binaries2.default.screenshot, screenshotArguments.concat(screenshotPath))); | ||
case 16: | ||
case 18: | ||
case 'end': | ||
@@ -89,0 +93,0 @@ return context$1$0.stop(); |
@@ -9,8 +9,12 @@ 'use strict'; | ||
var _fs = require('fs'); | ||
var _gracefulFs = require('graceful-fs'); | ||
var _fs2 = _interopRequireDefault(_fs); | ||
var _gracefulFs2 = _interopRequireDefault(_gracefulFs); | ||
var _path = require('path'); | ||
var _mkdirp = require('mkdirp'); | ||
var _mkdirp2 = _interopRequireDefault(_mkdirp); | ||
var _promisify = require('./promisify'); | ||
@@ -20,5 +24,13 @@ | ||
var stat = _promisify2.default(_fs2.default.stat); | ||
var mkdir = _promisify2.default(_fs2.default.mkdir); | ||
var _delay = require('./delay'); | ||
var _delay2 = _interopRequireDefault(_delay); | ||
var stat = _promisify2.default(_gracefulFs2.default.stat); | ||
var readdir = _promisify2.default(_gracefulFs2.default.readdir); | ||
var mkdir = _promisify2.default(_mkdirp2.default); | ||
var MAX_RETRY_COUNT = 10; | ||
var RETRY_DELAY = 100; | ||
function createDirectory(directoryPath) { | ||
@@ -47,2 +59,96 @@ return _regeneratorRuntime.async(function createDirectory$(context$1$0) { | ||
function readDirectory(directoryPath) { | ||
return _regeneratorRuntime.async(function readDirectory$(context$1$0) { | ||
while (1) switch (context$1$0.prev = context$1$0.next) { | ||
case 0: | ||
context$1$0.prev = 0; | ||
context$1$0.next = 3; | ||
return _regeneratorRuntime.awrap(readdir(directoryPath)); | ||
case 3: | ||
return context$1$0.abrupt('return', true); | ||
case 6: | ||
context$1$0.prev = 6; | ||
context$1$0.t0 = context$1$0['catch'](0); | ||
return context$1$0.abrupt('return', false); | ||
case 9: | ||
case 'end': | ||
return context$1$0.stop(); | ||
} | ||
}, null, this, [[0, 6]]); | ||
} | ||
function ensureDirectory(directoryPath) { | ||
var fileEnsured, i; | ||
return _regeneratorRuntime.async(function ensureDirectory$(context$1$0) { | ||
while (1) switch (context$1$0.prev = context$1$0.next) { | ||
case 0: | ||
context$1$0.next = 2; | ||
return _regeneratorRuntime.awrap(createDirectory(directoryPath)); | ||
case 2: | ||
context$1$0.t0 = context$1$0.sent; | ||
if (!context$1$0.t0) { | ||
context$1$0.next = 7; | ||
break; | ||
} | ||
context$1$0.next = 6; | ||
return _regeneratorRuntime.awrap(readDirectory(directoryPath)); | ||
case 6: | ||
context$1$0.t0 = context$1$0.sent; | ||
case 7: | ||
fileEnsured = context$1$0.t0; | ||
i = 0; | ||
case 9: | ||
if (!(i < MAX_RETRY_COUNT && !fileEnsured)) { | ||
context$1$0.next = 23; | ||
break; | ||
} | ||
context$1$0.next = 12; | ||
return _regeneratorRuntime.awrap(_delay2.default(RETRY_DELAY)); | ||
case 12: | ||
context$1$0.next = 14; | ||
return _regeneratorRuntime.awrap(createDirectory(directoryPath)); | ||
case 14: | ||
context$1$0.t1 = context$1$0.sent; | ||
if (!context$1$0.t1) { | ||
context$1$0.next = 19; | ||
break; | ||
} | ||
context$1$0.next = 18; | ||
return _regeneratorRuntime.awrap(readDirectory(directoryPath)); | ||
case 18: | ||
context$1$0.t1 = context$1$0.sent; | ||
case 19: | ||
fileEnsured = context$1$0.t1; | ||
case 20: | ||
i++; | ||
context$1$0.next = 9; | ||
break; | ||
case 23: | ||
return context$1$0.abrupt('return', fileEnsured); | ||
case 24: | ||
case 'end': | ||
return context$1$0.stop(); | ||
} | ||
}, null, this); | ||
} | ||
exports.default = function callee$0$0(fileName) { | ||
@@ -67,12 +173,16 @@ var directoryPath, stats; | ||
if (!(context$1$0.t0.code === 'ENOENT')) { | ||
context$1$0.next = 12; | ||
context$1$0.next = 14; | ||
break; | ||
} | ||
return context$1$0.abrupt('return', createDirectory(directoryPath)); | ||
context$1$0.next = 13; | ||
return _regeneratorRuntime.awrap(ensureDirectory(directoryPath)); | ||
case 12: | ||
case 13: | ||
return context$1$0.abrupt('return', context$1$0.sent); | ||
case 14: | ||
return context$1$0.abrupt('return', false); | ||
case 13: | ||
case 15: | ||
case 'end': | ||
@@ -79,0 +189,0 @@ return context$1$0.stop(); |
@@ -7,5 +7,5 @@ 'use strict'; | ||
var _fs = require('fs'); | ||
var _gracefulFs = require('graceful-fs'); | ||
var _fs2 = _interopRequireDefault(_fs); | ||
var _gracefulFs2 = _interopRequireDefault(_gracefulFs); | ||
@@ -18,3 +18,3 @@ var _pinkie = require('pinkie'); | ||
return new _pinkie2.default(function (resolve) { | ||
return _fs2.default.exists(filePath, resolve); | ||
return _gracefulFs2.default.exists(filePath, resolve); | ||
}); | ||
@@ -21,0 +21,0 @@ }; |
{ | ||
"name": "testcafe-browser-tools", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "An utility library for performing platform-dependent actions on browsers.", | ||
@@ -19,3 +19,5 @@ "homepage": "https://github.com/DevExpress/testcafe-browser-tools", | ||
"babel-runtime": "^5.6.15", | ||
"graceful-fs": "^4.1.11", | ||
"linux-platform-info": "^0.0.3", | ||
"mkdirp": "^0.5.1", | ||
"mustache": "^2.1.2", | ||
@@ -22,0 +24,0 @@ "os-family": "^1.0.0", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
1597228
1632
1
11
+ Addedgraceful-fs@^4.1.11
+ Addedmkdirp@^0.5.1
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)