babel-plugin-tester
Advanced tools
Comparing version 6.4.0 to 6.5.0
@@ -7,6 +7,8 @@ "use strict"; | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
module.exports = _objectSpread({}, babel); |
@@ -17,4 +17,6 @@ "use strict"; | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -407,4 +409,4 @@ | ||
expect(describeSpy).toHaveBeenCalledTimes(5); | ||
expect(itSpy).toHaveBeenCalledTimes(8); | ||
expect(itSpy.mock.calls).toEqual([[`changed`, expect.any(Function)], [`nested a`, expect.any(Function)], [`nested b`, expect.any(Function)], [`typescript`, expect.any(Function)], [`unchanged`, expect.any(Function)], [`nested with option`, expect.any(Function)], [`nested without option`, expect.any(Function)], [`without output file`, expect.any(Function)]]); | ||
expect(itSpy).toHaveBeenCalledTimes(10); | ||
expect(itSpy.mock.calls).toEqual([[`changed`, expect.any(Function)], [`jsx support`, expect.any(Function)], [`nested a`, expect.any(Function)], [`nested b`, expect.any(Function)], [`tsx support`, expect.any(Function)], [`typescript`, expect.any(Function)], [`unchanged`, expect.any(Function)], [`nested with option`, expect.any(Function)], [`nested without option`, expect.any(Function)], [`without output file`, expect.any(Function)]]); | ||
})); | ||
@@ -432,3 +434,12 @@ test('can fail tests in fixtures at an absolute path', | ||
})); | ||
expect(writeFileSyncSpy.mock.calls[0]).toEqual([expect.stringMatching(/(\/|\\)output\.(j|t)s$/), "'use strict';"]); | ||
var calls = writeFileSyncSpy.mock.calls[0]; | ||
var outputMatch = /(\/|\\)output\.(j|t)sx?$/; | ||
if (calls[0].endsWith('.jsx')) { | ||
expect(calls).toEqual([expect.stringMatching(outputMatch), 'export default <div></div>;']); | ||
} else if (calls[0].endsWith('.tsx')) { | ||
expect(calls).toEqual([expect.stringMatching(outputMatch), 'export default <div></div> as any;']); | ||
} else { | ||
expect(calls).toEqual([expect.stringMatching(outputMatch), "'use strict';"]); | ||
} | ||
})); | ||
@@ -772,3 +783,3 @@ test('uses the fixture filename in babelOptions', | ||
})); | ||
expect(formatResultSpy).toHaveBeenCalledTimes(9); | ||
expect(formatResultSpy).toHaveBeenCalledTimes(11); | ||
})); | ||
@@ -786,3 +797,3 @@ test('works with a formatter adding a empty line', | ||
})); | ||
expect(formatResultSpy).toHaveBeenCalledTimes(9); | ||
expect(formatResultSpy).toHaveBeenCalledTimes(11); | ||
})); | ||
@@ -819,3 +830,3 @@ test('gets options from options.json files when using fixtures', | ||
})); | ||
expect(optionRootFoo).toHaveBeenCalledTimes(8); | ||
expect(optionRootFoo).toHaveBeenCalledTimes(10); | ||
expect(optionFoo).toHaveBeenCalledTimes(2); | ||
@@ -867,6 +878,6 @@ expect(optionBar).toHaveBeenCalledTimes(1); | ||
})); | ||
expect(optionRootFoo).toHaveBeenCalledTimes(8); | ||
expect(optionRootFoo).toHaveBeenCalledTimes(10); | ||
expect(optionFoo).toHaveBeenCalledTimes(2); | ||
expect(optionBar).toHaveBeenCalledTimes(1); | ||
expect(programVisitor).toHaveBeenCalledTimes(9); | ||
expect(programVisitor).toHaveBeenCalledTimes(11); | ||
})); | ||
@@ -873,0 +884,0 @@ test('endOfLine - default', |
@@ -27,4 +27,6 @@ "use strict"; | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -310,4 +312,8 @@ | ||
var jsxCodePath = _path.default.join(fixtureDir, 'code.jsx'); | ||
var tsxCodePath = _path.default.join(fixtureDir, 'code.tsx'); | ||
var blockTitle = caseName.split('-').join(' '); | ||
var codePath = _pathExists.default.sync(jsCodePath) && jsCodePath || _pathExists.default.sync(tsCodePath) && tsCodePath; | ||
var codePath = _pathExists.default.sync(jsCodePath) && jsCodePath || _pathExists.default.sync(tsCodePath) && tsCodePath || _pathExists.default.sync(jsxCodePath) && jsxCodePath || _pathExists.default.sync(tsxCodePath) && tsxCodePath; | ||
var fixturePluginOptions = {}; | ||
@@ -322,3 +328,3 @@ | ||
createFixtureTests(fixtureDir, _objectSpread({}, options, { | ||
pluginOptions: _objectSpread({}, rootFixtureOptions, options.pluginOptions, fixturePluginOptions) | ||
pluginOptions: _objectSpread({}, rootFixtureOptions, {}, options.pluginOptions, {}, fixturePluginOptions) | ||
})); | ||
@@ -329,3 +335,3 @@ }); | ||
var ext = /\.ts$/.test(codePath) ? '.ts' : '.js'; | ||
var ext = `.${codePath.split('.').pop()}`; | ||
it(blockTitle, function () { | ||
@@ -347,3 +353,3 @@ var plugin = options.plugin, | ||
babelOptions: { | ||
plugins: [[plugin, _objectSpread({}, rootFixtureOptions, pluginOptions, fixturePluginOptions)]], | ||
plugins: [[plugin, _objectSpread({}, rootFixtureOptions, {}, pluginOptions, {}, fixturePluginOptions)]], | ||
// if they have a babelrc, then we'll let them use that | ||
@@ -350,0 +356,0 @@ // otherwise, we'll just use our simple config |
@@ -1,1 +0,1 @@ | ||
{"name":"babel-plugin-tester","version":"6.4.0","description":"Utilities for testing babel plugins","main":"dist/index.js","engines":{"node":"> 4","npm":"> 3"},"scripts":{"add-contributor":"kcd-scripts contributors add","build":"kcd-scripts build","lint":"kcd-scripts lint","test":"kcd-scripts test","test:update":"npm test -- --updateSnapshot --coverage","validate":"kcd-scripts validate","precommit":"kcd-scripts pre-commit"},"files":["dist"],"keywords":[],"author":"Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)","license":"MIT","dependencies":{"common-tags":"^1.4.0","invariant":"^2.2.2","lodash.mergewith":"^4.6.0","path-exists":"^3.0.0","strip-indent":"^2.0.0"},"devDependencies":{"@babel/core":"^7.2.0","@babel/plugin-proposal-async-generator-functions":"^7.2.0","@babel/plugin-transform-async-to-generator":"^7.2.0","@babel/preset-env":"^7.2.0","kcd-scripts":"^0.49.0"},"peerDependencies":{"@babel/core":"^7.0.0"},"eslintConfig":{"extends":"./node_modules/kcd-scripts/eslint.js","rules":{"max-lines":0,"max-lines-per-function":0,"prefer-object-spread":0,"no-useless-catch":0,"babel/camelcase":0,"babel/valid-typeof":0,"babel/no-unused-expressions":0,"babel/quotes":0,"jest/prefer-todo":0}},"eslintIgnore":["node_modules","coverage","dist","fixtures"],"babel":{"presets":[["@babel/preset-env",{"targets":{"node":"4.5"},"exclude":["transform-regenerator"]}]],"plugins":["@babel/plugin-transform-async-to-generator","@babel/plugin-proposal-async-generator-functions","@babel/plugin-proposal-object-rest-spread"]},"prettier":{"printWidth":80,"bracketSpacing":false,"semi":false,"singleQuote":true,"trailingComma":"all"},"repository":{"type":"git","url":"https://github.com/babel-utils/babel-plugin-tester.git"},"bugs":{"url":"https://github.com/babel-utils/babel-plugin-tester/issues"},"homepage":"https://github.com/babel-utils/babel-plugin-tester#readme"} | ||
{"name":"babel-plugin-tester","version":"6.5.0","description":"Utilities for testing babel plugins","main":"dist/index.js","engines":{"node":"> 4","npm":"> 3"},"scripts":{"add-contributor":"kcd-scripts contributors add","build":"kcd-scripts build","lint":"kcd-scripts lint","test":"kcd-scripts test","test:update":"npm test -- --updateSnapshot --coverage","validate":"kcd-scripts validate","precommit":"kcd-scripts pre-commit"},"files":["dist"],"keywords":[],"author":"Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)","license":"MIT","dependencies":{"common-tags":"^1.4.0","invariant":"^2.2.2","lodash.mergewith":"^4.6.0","path-exists":"^3.0.0","strip-indent":"^2.0.0"},"devDependencies":{"@babel/core":"^7.2.0","@babel/plugin-proposal-async-generator-functions":"^7.2.0","@babel/plugin-syntax-jsx":"^7.2.0","@babel/plugin-syntax-typescript":"^7.3.3","@babel/plugin-transform-async-to-generator":"^7.2.0","@babel/preset-env":"^7.2.0","kcd-scripts":"^0.49.0"},"peerDependencies":{"@babel/core":"^7.0.0"},"eslintConfig":{"extends":"./node_modules/kcd-scripts/eslint.js","rules":{"max-lines":0,"max-lines-per-function":0,"prefer-object-spread":0,"no-useless-catch":0,"babel/camelcase":0,"babel/valid-typeof":0,"babel/no-unused-expressions":0,"babel/quotes":0,"jest/prefer-todo":0}},"eslintIgnore":["node_modules","coverage","dist","fixtures"],"babel":{"presets":[["@babel/preset-env",{"targets":{"node":"4.5"},"exclude":["transform-regenerator"]}]],"plugins":["@babel/plugin-transform-async-to-generator","@babel/plugin-proposal-async-generator-functions","@babel/plugin-proposal-object-rest-spread"]},"prettier":{"printWidth":80,"bracketSpacing":false,"semi":false,"singleQuote":true,"trailingComma":"all"},"repository":{"type":"git","url":"https://github.com/babel-utils/babel-plugin-tester.git"},"bugs":{"url":"https://github.com/babel-utils/babel-plugin-tester/issues"},"homepage":"https://github.com/babel-utils/babel-plugin-tester#readme"} |
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
72767
32
1377
7