@babel/helper-transform-fixture-test-runner
Advanced tools
Comparing version 7.24.5 to 7.24.6
@@ -26,3 +26,2 @@ "use strict"; | ||
var _os = require("os"); | ||
var _makeDir = require("make-dir"); | ||
var _fsReaddirRecursive = require("fs-readdir-recursive"); | ||
@@ -393,8 +392,10 @@ var _module = require("module"); | ||
const tmpDir = (0, _fs.realpathSync)(_os.tmpdir()); | ||
const readDir = function (loc, filter) { | ||
const readDir = function (loc, pathFilter) { | ||
const files = {}; | ||
if (_fs.default.existsSync(loc)) { | ||
_fsReaddirRecursive(loc, filter).forEach(function (filename) { | ||
files[filename] = (0, _helperFixtures.readFile)(_path.join(loc, filename)); | ||
}); | ||
{ | ||
_fsReaddirRecursive(loc, pathFilter).forEach(function (filename) { | ||
files[filename] = (0, _helperFixtures.readFile)(_path.join(loc, filename)); | ||
}); | ||
} | ||
} | ||
@@ -404,20 +405,27 @@ return files; | ||
const outputFileSync = function (filePath, data) { | ||
(0, _makeDir.sync)(_path.dirname(filePath)); | ||
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? _fs.default.mkdirSync : require("make-dir").sync)(_path.dirname(filePath), { | ||
recursive: true | ||
}); | ||
_fs.default.writeFileSync(filePath, data); | ||
}; | ||
function deleteDir(path) { | ||
if (_fs.default.existsSync(path)) { | ||
_fs.default.readdirSync(path).forEach(function (file) { | ||
const curPath = path + "/" + file; | ||
if (_fs.default.lstatSync(curPath).isDirectory()) { | ||
deleteDir(curPath); | ||
} else { | ||
_fs.default.unlinkSync(curPath); | ||
} | ||
}); | ||
_fs.default.rmdirSync(path); | ||
} | ||
(_fs.default.rmSync || function d(p) { | ||
if (_fs.default.existsSync(p)) { | ||
_fs.default.readdirSync(p).forEach(function (f) { | ||
const c = p + "/" + f; | ||
if (_fs.default.lstatSync(c).isDirectory()) { | ||
d(c); | ||
} else { | ||
_fs.default.unlinkSync(c); | ||
} | ||
}); | ||
_fs.default.rmdirSync(p); | ||
} | ||
})(path, { | ||
force: true, | ||
recursive: true | ||
}); | ||
} | ||
const fileFilter = function (x) { | ||
return x !== ".DS_Store"; | ||
const pathFilter = function (x) { | ||
return _path.basename(x) !== ".DS_Store"; | ||
}; | ||
@@ -465,3 +473,3 @@ const assertTest = function (stdout, stderr, ipcMessage, opts, tmpDir) { | ||
if (opts.outFiles) { | ||
const actualFiles = readDir(tmpDir, fileFilter); | ||
const actualFiles = readDir(tmpDir, pathFilter); | ||
Object.keys(actualFiles).forEach(function (filename) { | ||
@@ -549,4 +557,4 @@ try { | ||
opts.testLoc = testLoc; | ||
opts.outFiles = readDir(_path.join(testLoc, "out-files"), fileFilter); | ||
opts.inFiles = readDir(_path.join(testLoc, "in-files"), fileFilter); | ||
opts.outFiles = readDir(_path.join(testLoc, "out-files"), pathFilter); | ||
opts.inFiles = readDir(_path.join(testLoc, "in-files"), pathFilter); | ||
const babelrcLoc = _path.join(testLoc, ".babelrc"); | ||
@@ -574,3 +582,5 @@ const babelIgnoreLoc = _path.join(testLoc, ".babelignore"); | ||
deleteDir(tmpLoc); | ||
(0, _makeDir.sync)(tmpLoc); | ||
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? _fs.default.mkdirSync : require("make-dir").sync)(tmpLoc, { | ||
recursive: true | ||
}); | ||
const { | ||
@@ -577,0 +587,0 @@ inFiles |
{ | ||
"name": "@babel/helper-transform-fixture-test-runner", | ||
"version": "7.24.5", | ||
"version": "7.24.6", | ||
"description": "Transform test runner for @babel/helper-fixtures module", | ||
@@ -18,6 +18,6 @@ "author": "The Babel Team (https://babel.dev/team)", | ||
"dependencies": { | ||
"@babel/code-frame": "^7.24.2", | ||
"@babel/core": "^7.24.5", | ||
"@babel/helper-check-duplicate-nodes": "^7.22.5", | ||
"@babel/helper-fixtures": "^7.24.4", | ||
"@babel/code-frame": "^7.24.6", | ||
"@babel/core": "^7.24.6", | ||
"@babel/helper-check-duplicate-nodes": "^7.24.6", | ||
"@babel/helper-fixtures": "^7.24.6", | ||
"@jridgewell/trace-mapping": "^0.3.25", | ||
@@ -24,0 +24,0 @@ "fs-readdir-recursive": "^1.1.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
109241
824