@babel/helper-fixtures
Advanced tools
Comparing version 7.6.2 to 7.6.3
132
lib/index.js
@@ -10,68 +10,20 @@ "use strict"; | ||
function _cloneDeep() { | ||
const data = _interopRequireDefault(require("lodash/cloneDeep")); | ||
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep")); | ||
_cloneDeep = function () { | ||
return data; | ||
}; | ||
var _clone = _interopRequireDefault(require("lodash/clone")); | ||
return data; | ||
} | ||
var _extend = _interopRequireDefault(require("lodash/extend")); | ||
function _clone() { | ||
const data = _interopRequireDefault(require("lodash/clone")); | ||
var _semver = _interopRequireDefault(require("semver")); | ||
_clone = function () { | ||
return data; | ||
}; | ||
var _path = _interopRequireDefault(require("path")); | ||
return data; | ||
} | ||
var _fs = _interopRequireDefault(require("fs")); | ||
function _extend() { | ||
const data = _interopRequireDefault(require("lodash/extend")); | ||
_extend = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _semver() { | ||
const data = _interopRequireDefault(require("semver")); | ||
_semver = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _path() { | ||
const data = _interopRequireDefault(require("path")); | ||
_path = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _fs() { | ||
const data = _interopRequireDefault(require("fs")); | ||
_fs = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const nodeVersion = _semver().default.clean(process.version.slice(1)); | ||
const nodeVersion = _semver.default.clean(process.version.slice(1)); | ||
function humanize(val, noext) { | ||
if (noext) val = _path().default.basename(val, _path().default.extname(val)); | ||
if (noext) val = _path.default.basename(val, _path.default.extname(val)); | ||
return val.replace(/-/g, " "); | ||
@@ -89,3 +41,3 @@ } | ||
function assertDirectory(loc) { | ||
if (!_fs().default.statSync(loc).isDirectory()) { | ||
if (!_fs.default.statSync(loc).isDirectory()) { | ||
throw new Error(`Expected ${loc} to be a directory.`); | ||
@@ -100,5 +52,5 @@ } | ||
const ext = _path().default.extname(name); | ||
const ext = _path.default.extname(name); | ||
const base = _path().default.basename(name, ext); | ||
const base = _path.default.basename(name, ext); | ||
@@ -115,3 +67,3 @@ return name[0] === "." || ext === ".md" || base === "LICENSE" || base === "options"; | ||
const name = filepath + ext; | ||
if (_fs().default.existsSync(name)) matches.push(name); | ||
if (_fs.default.existsSync(name)) matches.push(name); | ||
} | ||
@@ -132,6 +84,6 @@ | ||
for (const suiteName of _fs().default.readdirSync(entryLoc)) { | ||
for (const suiteName of _fs.default.readdirSync(entryLoc)) { | ||
if (shouldIgnore(suiteName)) continue; | ||
const suite = { | ||
options: (0, _clone().default)(rootOpts), | ||
options: (0, _clone.default)(rootOpts), | ||
tests: [], | ||
@@ -146,3 +98,3 @@ title: humanize(suiteName), | ||
for (const taskName of _fs().default.readdirSync(suite.filename)) { | ||
for (const taskName of _fs.default.readdirSync(suite.filename)) { | ||
push(taskName, suite.filename + "/" + taskName); | ||
@@ -152,3 +104,3 @@ } | ||
function push(taskName, taskDir) { | ||
const taskDirStats = _fs().default.statSync(taskDir); | ||
const taskDirStats = _fs.default.statSync(taskDir); | ||
@@ -159,3 +111,3 @@ let actualLoc = findFile(taskDir + "/input"); | ||
if (taskDirStats.isDirectory() && !actualLoc && !execLoc) { | ||
if (_fs().default.readdirSync(taskDir).length > 0) { | ||
if (_fs.default.readdirSync(taskDir).length > 0) { | ||
console.warn(`Skipped test folder with invalid layout: ${taskDir}`); | ||
@@ -175,10 +127,10 @@ } | ||
const actualLocAlias = suiteName + "/" + taskName + "/" + _path().default.basename(actualLoc); | ||
const actualLocAlias = suiteName + "/" + taskName + "/" + _path.default.basename(actualLoc); | ||
const expectLocAlias = suiteName + "/" + taskName + "/" + _path().default.basename(actualLoc); | ||
const expectLocAlias = suiteName + "/" + taskName + "/" + _path.default.basename(actualLoc); | ||
let execLocAlias = suiteName + "/" + taskName + "/" + _path().default.basename(actualLoc); | ||
let execLocAlias = suiteName + "/" + taskName + "/" + _path.default.basename(actualLoc); | ||
if (taskDirStats.isFile()) { | ||
const ext = _path().default.extname(taskDir); | ||
const ext = _path.default.extname(taskDir); | ||
@@ -190,7 +142,7 @@ if (EXTENSIONS.indexOf(ext) === -1) return; | ||
const taskOpts = (0, _cloneDeep().default)(suite.options); | ||
const taskOpts = (0, _cloneDeep.default)(suite.options); | ||
const taskOptsLoc = tryResolve(taskDir + "/options"); | ||
if (taskOptsLoc) (0, _extend().default)(taskOpts, require(taskOptsLoc)); | ||
if (taskOptsLoc) (0, _extend.default)(taskOpts, require(taskOptsLoc)); | ||
const test = { | ||
optionsDir: taskOptsLoc ? _path().default.dirname(taskOptsLoc) : null, | ||
optionsDir: taskOptsLoc ? _path.default.dirname(taskOptsLoc) : null, | ||
title: humanize(taskName, true), | ||
@@ -227,3 +179,3 @@ disabled: taskName[0] === ".", | ||
if (taskOpts.minNodeVersion) { | ||
const minimumVersion = _semver().default.clean(taskOpts.minNodeVersion); | ||
const minimumVersion = _semver.default.clean(taskOpts.minNodeVersion); | ||
@@ -234,3 +186,3 @@ if (minimumVersion == null) { | ||
if (_semver().default.lt(nodeVersion, minimumVersion)) { | ||
if (_semver.default.lt(nodeVersion, minimumVersion)) { | ||
return; | ||
@@ -242,2 +194,20 @@ } | ||
if (taskOpts.os) { | ||
let os = taskOpts.os; | ||
if (!Array.isArray(os) && typeof os !== "string") { | ||
throw new Error(`'os' should be either string or string array: ${taskOpts.os}`); | ||
} | ||
if (typeof os === "string") { | ||
os = [os]; | ||
} | ||
if (!os.includes(process.platform)) { | ||
return; | ||
} | ||
delete taskOpts.os; | ||
} | ||
if (test.exec.code.indexOf("// Async.") >= 0) { | ||
@@ -250,3 +220,3 @@ return; | ||
if (_fs().default.existsSync(sourceMappingsLoc)) { | ||
if (_fs.default.existsSync(sourceMappingsLoc)) { | ||
test.sourceMappings = JSON.parse(readFile(sourceMappingsLoc)); | ||
@@ -257,3 +227,3 @@ } | ||
if (_fs().default.existsSync(sourceMapLoc)) { | ||
if (_fs.default.existsSync(sourceMapLoc)) { | ||
test.sourceMap = JSON.parse(readFile(sourceMapLoc)); | ||
@@ -264,3 +234,3 @@ } | ||
if (_fs().default.existsSync(inputMapLoc)) { | ||
if (_fs.default.existsSync(inputMapLoc)) { | ||
test.inputSourceMap = JSON.parse(readFile(inputMapLoc)); | ||
@@ -308,6 +278,6 @@ } | ||
for (const name of _fs().default.readdirSync(entryLoc)) { | ||
for (const name of _fs.default.readdirSync(entryLoc)) { | ||
if (shouldIgnore(name, ignore)) continue; | ||
const loc = _path().default.join(entryLoc, name); | ||
const loc = _path.default.join(entryLoc, name); | ||
@@ -322,4 +292,4 @@ assertDirectory(loc); | ||
function readFile(filename) { | ||
if (_fs().default.existsSync(filename)) { | ||
let file = _fs().default.readFileSync(filename, "utf8").trimRight(); | ||
if (_fs.default.existsSync(filename)) { | ||
let file = _fs.default.readFileSync(filename, "utf8").trimRight(); | ||
@@ -326,0 +296,0 @@ file = file.replace(/\r\n/g, "\n"); |
{ | ||
"name": "@babel/helper-fixtures", | ||
"version": "7.6.2", | ||
"version": "7.6.3", | ||
"description": "Helper function to support fixtures", | ||
@@ -16,3 +16,3 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
}, | ||
"gitHead": "b9cb4af953afb1a5aeed9b18526192ab15bb45c1" | ||
"gitHead": "d329156ebc17da01382acb83e212cb4328534ebc" | ||
} |
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
10022
216