babel-plugin-tester
Advanced tools
Comparing version 3.3.0 to 4.0.0
@@ -74,2 +74,3 @@ 'use strict'; | ||
var testNumber = 1; | ||
if (fixtures) { | ||
@@ -92,3 +93,3 @@ testFixtures(_extends({ | ||
return describe(describeBlockTitle, function () { | ||
var promises = testAsArray.map(function (testConfig, index) { | ||
var promises = testAsArray.map(function (testConfig) { | ||
var testerWrapper = function () { | ||
@@ -136,10 +137,3 @@ var _ref2 = _asyncToGenerator(function* () { | ||
var _merge = (0, _lodash2.default)({}, testerConfig, toTestConfig({ | ||
testConfig, | ||
index, | ||
plugin, | ||
pluginName, | ||
pluginOptions, | ||
filename | ||
})), | ||
var _merge = (0, _lodash2.default)({}, testerConfig, toTestConfig(testConfig)), | ||
skip = _merge.skip, | ||
@@ -218,2 +212,28 @@ only = _merge.only, | ||
}); | ||
function toTestConfig(testConfig) { | ||
if (typeof testConfig === 'string') { | ||
testConfig = { code: testConfig }; | ||
} | ||
var _testConfig = testConfig, | ||
title = _testConfig.title, | ||
fixture = _testConfig.fixture, | ||
_testConfig$code = _testConfig.code, | ||
code = _testConfig$code === undefined ? getCode(filename, fixture) : _testConfig$code, | ||
_testConfig$fullTitle = _testConfig.fullTitle, | ||
fullTitle = _testConfig$fullTitle === undefined ? title || `${testNumber++}. ${pluginName}` : _testConfig$fullTitle, | ||
_testConfig$output = _testConfig.output, | ||
output = _testConfig$output === undefined ? getCode(filename, testConfig.outputFixture) : _testConfig$output, | ||
_testConfig$pluginOpt = _testConfig.pluginOptions, | ||
testOptions = _testConfig$pluginOpt === undefined ? pluginOptions : _testConfig$pluginOpt; | ||
return (0, _lodash2.default)({ | ||
babelOptions: { filename: getPath(filename, fixture) } | ||
}, testConfig, { | ||
babelOptions: { plugins: [[plugin, testOptions]] }, | ||
title: fullTitle, | ||
code: (0, _stripIndent2.default)(code).trim(), | ||
output: (0, _stripIndent2.default)(output).trim() | ||
}); | ||
} | ||
} | ||
@@ -274,35 +294,2 @@ | ||
function toTestConfig(_ref4) { | ||
var testConfig = _ref4.testConfig, | ||
index = _ref4.index, | ||
plugin = _ref4.plugin, | ||
pluginName = _ref4.pluginName, | ||
pluginOptions = _ref4.pluginOptions, | ||
filename = _ref4.filename; | ||
if (typeof testConfig === 'string') { | ||
testConfig = { code: testConfig }; | ||
} | ||
var _testConfig = testConfig, | ||
title = _testConfig.title, | ||
fixture = _testConfig.fixture, | ||
_testConfig$code = _testConfig.code, | ||
code = _testConfig$code === undefined ? getCode(filename, fixture) : _testConfig$code, | ||
_testConfig$fullTitle = _testConfig.fullTitle, | ||
fullTitle = _testConfig$fullTitle === undefined ? `${index + 1}. ${title || pluginName}` : _testConfig$fullTitle, | ||
_testConfig$output = _testConfig.output, | ||
output = _testConfig$output === undefined ? getCode(filename, testConfig.outputFixture) : _testConfig$output, | ||
_testConfig$pluginOpt = _testConfig.pluginOptions, | ||
testOptions = _testConfig$pluginOpt === undefined ? pluginOptions : _testConfig$pluginOpt; | ||
return (0, _lodash2.default)({ | ||
babelOptions: { filename: getPath(filename, fixture) } | ||
}, testConfig, { | ||
babelOptions: { plugins: [[plugin, testOptions]] }, | ||
title: fullTitle, | ||
code: (0, _stripIndent2.default)(code).trim(), | ||
output: (0, _stripIndent2.default)(output).trim() | ||
}); | ||
} | ||
function getCode(filename, fixture) { | ||
@@ -309,0 +296,0 @@ if (!fixture) { |
{ | ||
"name": "babel-plugin-tester", | ||
"version": "3.3.0", | ||
"version": "4.0.0", | ||
"description": "Utilities for testing babel plugins", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
31851
284