Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@babel/helper-fixtures

Package Overview
Dependencies
Maintainers
6
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-fixtures - npm Package Compare versions

Comparing version 7.8.3 to 7.8.6

284

lib/index.js

@@ -74,181 +74,181 @@ "use strict";

function get(entryLoc) {
const suites = [];
let rootOpts = {};
const rootOptsLoc = tryResolve(entryLoc + "/options");
if (rootOptsLoc) rootOpts = require(rootOptsLoc);
function pushTask(taskName, taskDir, suite, suiteName) {
const taskDirStats = _fs.default.statSync(taskDir);
for (const suiteName of _fs.default.readdirSync(entryLoc)) {
if (shouldIgnore(suiteName)) continue;
const suite = {
options: (0, _clone.default)(rootOpts),
tests: [],
title: humanize(suiteName),
filename: entryLoc + "/" + suiteName
};
assertDirectory(suite.filename);
suites.push(suite);
const suiteOptsLoc = tryResolve(suite.filename + "/options");
if (suiteOptsLoc) suite.options = require(suiteOptsLoc);
let actualLoc = findFile(taskDir + "/input");
let execLoc = findFile(taskDir + "/exec");
for (const taskName of _fs.default.readdirSync(suite.filename)) {
push(taskName, suite.filename + "/" + taskName);
if (taskDirStats.isDirectory() && !actualLoc && !execLoc) {
if (_fs.default.readdirSync(taskDir).length > 0) {
console.warn(`Skipped test folder with invalid layout: ${taskDir}`);
}
function push(taskName, taskDir) {
const taskDirStats = _fs.default.statSync(taskDir);
return;
} else if (!actualLoc) {
actualLoc = taskDir + "/input.js";
} else if (!execLoc) {
execLoc = taskDir + "/exec.js";
}
let actualLoc = findFile(taskDir + "/input");
let execLoc = findFile(taskDir + "/exec");
const expectLoc = findFile(taskDir + "/output", true) || taskDir + "/output.js";
const stdoutLoc = taskDir + "/stdout.txt";
const stderrLoc = taskDir + "/stderr.txt";
if (taskDirStats.isDirectory() && !actualLoc && !execLoc) {
if (_fs.default.readdirSync(taskDir).length > 0) {
console.warn(`Skipped test folder with invalid layout: ${taskDir}`);
}
const actualLocAlias = suiteName + "/" + taskName + "/" + _path.default.basename(actualLoc);
return;
} else if (!actualLoc) {
actualLoc = taskDir + "/input.js";
} else if (!execLoc) {
execLoc = taskDir + "/exec.js";
}
const expectLocAlias = suiteName + "/" + taskName + "/" + _path.default.basename(actualLoc);
const expectLoc = findFile(taskDir + "/output", true) || taskDir + "/output.js";
const stdoutLoc = taskDir + "/stdout.txt";
const stderrLoc = taskDir + "/stderr.txt";
let execLocAlias = suiteName + "/" + taskName + "/" + _path.default.basename(actualLoc);
const actualLocAlias = suiteName + "/" + taskName + "/" + _path.default.basename(actualLoc);
if (taskDirStats.isFile()) {
const ext = _path.default.extname(taskDir);
const expectLocAlias = suiteName + "/" + taskName + "/" + _path.default.basename(actualLoc);
if (EXTENSIONS.indexOf(ext) === -1) return;
execLoc = taskDir;
execLocAlias = suiteName + "/" + taskName;
}
let execLocAlias = suiteName + "/" + taskName + "/" + _path.default.basename(actualLoc);
const taskOpts = (0, _cloneDeep.default)(suite.options);
const taskOptsLoc = tryResolve(taskDir + "/options");
if (taskOptsLoc) (0, _extend.default)(taskOpts, require(taskOptsLoc));
const test = {
optionsDir: taskOptsLoc ? _path.default.dirname(taskOptsLoc) : null,
title: humanize(taskName, true),
disabled: taskName[0] === ".",
options: taskOpts,
validateLogs: taskOpts.validateLogs,
ignoreOutput: taskOpts.ignoreOutput,
stdout: {
loc: stdoutLoc,
code: readFile(stdoutLoc)
},
stderr: {
loc: stderrLoc,
code: readFile(stderrLoc)
},
exec: {
loc: execLoc,
code: readFile(execLoc),
filename: execLocAlias
},
actual: {
loc: actualLoc,
code: readFile(actualLoc),
filename: actualLocAlias
},
expect: {
loc: expectLoc,
code: readFile(expectLoc),
filename: expectLocAlias
}
};
if (taskDirStats.isFile()) {
const ext = _path.default.extname(taskDir);
if (taskOpts.minNodeVersion) {
const minimumVersion = _semver.default.clean(taskOpts.minNodeVersion);
if (EXTENSIONS.indexOf(ext) === -1) return;
execLoc = taskDir;
execLocAlias = suiteName + "/" + taskName;
}
if (minimumVersion == null) {
throw new Error(`'minNodeVersion' has invalid semver format: ${taskOpts.minNodeVersion}`);
}
const taskOpts = (0, _cloneDeep.default)(suite.options);
const taskOptsLoc = tryResolve(taskDir + "/options");
if (taskOptsLoc) (0, _extend.default)(taskOpts, require(taskOptsLoc));
const test = {
optionsDir: taskOptsLoc ? _path.default.dirname(taskOptsLoc) : null,
title: humanize(taskName, true),
disabled: taskName[0] === ".",
options: taskOpts,
validateLogs: taskOpts.validateLogs,
ignoreOutput: taskOpts.ignoreOutput,
stdout: {
loc: stdoutLoc,
code: readFile(stdoutLoc)
},
stderr: {
loc: stderrLoc,
code: readFile(stderrLoc)
},
exec: {
loc: execLoc,
code: readFile(execLoc),
filename: execLocAlias
},
actual: {
loc: actualLoc,
code: readFile(actualLoc),
filename: actualLocAlias
},
expect: {
loc: expectLoc,
code: readFile(expectLoc),
filename: expectLocAlias
}
};
if (_semver.default.lt(nodeVersion, minimumVersion)) {
return;
}
if (taskOpts.minNodeVersion) {
const minimumVersion = _semver.default.clean(taskOpts.minNodeVersion);
delete taskOpts.minNodeVersion;
}
if (minimumVersion == null) {
throw new Error(`'minNodeVersion' has invalid semver format: ${taskOpts.minNodeVersion}`);
}
if (taskOpts.os) {
let os = taskOpts.os;
if (_semver.default.lt(nodeVersion, minimumVersion)) {
return;
}
if (!Array.isArray(os) && typeof os !== "string") {
throw new Error(`'os' should be either string or string array: ${taskOpts.os}`);
}
delete taskOpts.minNodeVersion;
}
if (typeof os === "string") {
os = [os];
}
if (taskOpts.os) {
let os = taskOpts.os;
if (!os.includes(process.platform)) {
return;
}
if (!Array.isArray(os) && typeof os !== "string") {
throw new Error(`'os' should be either string or string array: ${taskOpts.os}`);
}
delete taskOpts.os;
}
if (typeof os === "string") {
os = [os];
}
if (test.exec.code.indexOf("// Async.") >= 0) {
return;
}
if (!os.includes(process.platform)) {
return;
}
suite.tests.push(test);
const sourceMappingsLoc = taskDir + "/source-mappings.json";
delete taskOpts.os;
}
if (_fs.default.existsSync(sourceMappingsLoc)) {
test.sourceMappings = JSON.parse(readFile(sourceMappingsLoc));
}
if (test.exec.code.indexOf("// Async.") >= 0) {
return;
}
const sourceMapLoc = taskDir + "/source-map.json";
suite.tests.push(test);
const sourceMappingsLoc = taskDir + "/source-mappings.json";
if (_fs.default.existsSync(sourceMapLoc)) {
test.sourceMap = JSON.parse(readFile(sourceMapLoc));
}
if (_fs.default.existsSync(sourceMappingsLoc)) {
test.sourceMappings = JSON.parse(readFile(sourceMappingsLoc));
}
const inputMapLoc = taskDir + "/input-source-map.json";
const sourceMapLoc = taskDir + "/source-map.json";
if (_fs.default.existsSync(inputMapLoc)) {
test.inputSourceMap = JSON.parse(readFile(inputMapLoc));
}
if (_fs.default.existsSync(sourceMapLoc)) {
test.sourceMap = JSON.parse(readFile(sourceMapLoc));
}
if (taskOpts.throws) {
if (test.expect.code) {
throw new Error("Test cannot throw and also return output code: " + expectLoc);
}
const inputMapLoc = taskDir + "/input-source-map.json";
if (test.sourceMappings) {
throw new Error("Test cannot throw and also return sourcemappings: " + sourceMappingsLoc);
}
if (_fs.default.existsSync(inputMapLoc)) {
test.inputSourceMap = JSON.parse(readFile(inputMapLoc));
}
if (test.sourceMap) {
throw new Error("Test cannot throw and also return sourcemaps: " + sourceMapLoc);
}
}
if (taskOpts.throws) {
if (test.expect.code) {
throw new Error("Test cannot throw and also return output code: " + expectLoc);
}
if (!test.validateLogs && (test.stdout.code || test.stderr.code)) {
throw new Error("stdout.txt and stderr.txt are only allowed when the 'validateLogs' option is enabled: " + (test.stdout.code ? stdoutLoc : stderrLoc));
}
if (test.sourceMappings) {
throw new Error("Test cannot throw and also return sourcemappings: " + sourceMappingsLoc);
}
if (test.options.ignoreOutput) {
if (test.expect.code) {
throw new Error("Test cannot ignore its output and also validate it: " + expectLoc);
}
if (test.sourceMap) {
throw new Error("Test cannot throw and also return sourcemaps: " + sourceMapLoc);
}
}
if (!test.validateLogs) {
throw new Error("ignoreOutput can only be used when validateLogs is true: " + taskOptsLoc);
}
}
if (!test.validateLogs && (test.stdout.code || test.stderr.code)) {
throw new Error("stdout.txt and stderr.txt are only allowed when the 'validateLogs' option is enabled: " + (test.stdout.code ? stdoutLoc : stderrLoc));
}
delete test.options.validateLogs;
delete test.options.ignoreOutput;
}
if (test.options.ignoreOutput) {
if (test.expect.code) {
throw new Error("Test cannot ignore its output and also validate it: " + expectLoc);
}
function get(entryLoc) {
const suites = [];
let rootOpts = {};
const rootOptsLoc = tryResolve(entryLoc + "/options");
if (rootOptsLoc) rootOpts = require(rootOptsLoc);
if (!test.validateLogs) {
throw new Error("ignoreOutput can only be used when validateLogs is true: " + taskOptsLoc);
}
}
for (const suiteName of _fs.default.readdirSync(entryLoc)) {
if (shouldIgnore(suiteName)) continue;
const suite = {
options: (0, _clone.default)(rootOpts),
tests: [],
title: humanize(suiteName),
filename: entryLoc + "/" + suiteName
};
assertDirectory(suite.filename);
suites.push(suite);
const suiteOptsLoc = tryResolve(suite.filename + "/options");
if (suiteOptsLoc) suite.options = require(suiteOptsLoc);
delete test.options.validateLogs;
delete test.options.ignoreOutput;
for (const taskName of _fs.default.readdirSync(suite.filename)) {
pushTask(taskName, suite.filename + "/" + taskName, suite, suiteName);
}

@@ -255,0 +255,0 @@ }

{
"name": "@babel/helper-fixtures",
"version": "7.8.3",
"version": "7.8.6",
"description": "Helper function to support fixtures",

@@ -16,3 +16,3 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>",

},
"gitHead": "a7620bd266ae1345975767bbc7abf09034437017"
"gitHead": "750d3dde3bd2d390819820fd22c05441da78751b"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc