babel-plugin-tester
Advanced tools
Comparing version 5.5.1 to 5.5.2
@@ -51,5 +51,5 @@ 'use strict'; | ||
} | ||
}; | ||
function pluginTester() { | ||
// eslint-disable-next-line max-lines-per-function | ||
};function pluginTester() { | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
@@ -200,3 +200,3 @@ | ||
assertError(result, error); | ||
} else if (output) { | ||
} else if (typeof output === 'string') { | ||
_assert2.default.equal(result, output, 'Output is incorrect.'); | ||
@@ -224,3 +224,3 @@ } else { | ||
_testConfig$output = _testConfig.output, | ||
output = _testConfig$output === undefined ? getCode(filename, testConfig.outputFixture) : _testConfig$output, | ||
output = _testConfig$output === undefined ? getCode(filename, testConfig.outputFixture) || undefined : _testConfig$output, | ||
_testConfig$pluginOpt = _testConfig.pluginOptions, | ||
@@ -231,8 +231,7 @@ testOptions = _testConfig$pluginOpt === undefined ? pluginOptions : _testConfig$pluginOpt; | ||
babelOptions: { filename: getPath(filename, fixture) } | ||
}, testConfig, { | ||
}, testConfig, _extends({ | ||
babelOptions: { plugins: [[plugin, testOptions]] }, | ||
title: fullTitle, | ||
code: (0, _stripIndent2.default)(code).trim(), | ||
output: (0, _stripIndent2.default)(output).trim() | ||
}); | ||
code: (0, _stripIndent2.default)(code).trim() | ||
}, output ? { output: (0, _stripIndent2.default)(output).trim() } : {})); | ||
} | ||
@@ -239,0 +238,0 @@ } |
@@ -1,1 +0,1 @@ | ||
{"name":"babel-plugin-tester","version":"5.5.1","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 precommit"},"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.merge":"^4.6.0","path-exists":"^3.0.0","strip-indent":"^2.0.0"},"devDependencies":{"babel-core":"^6.25.0","babel-plugin-syntax-trailing-function-commas":"^6.22.0","babel-plugin-transform-async-generator-functions":"^6.24.1","babel-plugin-transform-async-to-generator":"^6.24.1","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-preset-env":"^1.5.2","kcd-scripts":"^0.16.3"},"peerDependencies":{"babel-core":"^6.0.0 || ^7.0.0-alpha || ^7.0.0-beta || ^7.0.0"},"eslintConfig":{"extends":"./node_modules/kcd-scripts/eslint.js","rules":{"max-lines":0}},"eslintIgnore":["node_modules","coverage","dist","fixtures"],"babel":{"presets":[["env",{"targets":{"node":"4.5"},"exclude":["transform-regenerator"]}]],"plugins":["babel-plugin-syntax-trailing-function-commas","transform-async-to-generator","transform-async-generator-functions","transform-object-rest-spread"]},"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":"5.5.2","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 precommit"},"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.merge":"^4.6.0","path-exists":"^3.0.0","strip-indent":"^2.0.0"},"devDependencies":{"babel-core":"^6.25.0","babel-plugin-syntax-trailing-function-commas":"^6.22.0","babel-plugin-transform-async-generator-functions":"^6.24.1","babel-plugin-transform-async-to-generator":"^6.24.1","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-preset-env":"^1.5.2","kcd-scripts":"^0.42.1"},"peerDependencies":{"babel-core":"^6.0.0 || ^7.0.0-alpha || ^7.0.0-beta || ^7.0.0"},"eslintConfig":{"extends":"./node_modules/kcd-scripts/eslint.js","rules":{"jest/valid-describe":0,"max-lines":0,"semi":[2,"never"]}},"eslintIgnore":["node_modules","coverage","dist","fixtures"],"babel":{"presets":[["env",{"targets":{"node":"4.5"},"exclude":["transform-regenerator"]}]],"plugins":["babel-plugin-syntax-trailing-function-commas","transform-async-to-generator","transform-async-generator-functions","transform-object-rest-spread"]},"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"} |
@@ -10,5 +10,5 @@ # babel-plugin-tester | ||
[![downloads][downloads-badge]][npm-stat] | ||
[![MIT License][license-badge]][LICENSE] | ||
[![MIT License][license-badge]][license] | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors) | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors) | ||
[![PRs Welcome][prs-badge]][prs] | ||
@@ -34,2 +34,22 @@ [![Donate][donate-badge]][donate] | ||
<!-- START doctoc generated TOC please keep comment here to allow auto update --> | ||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [import](#import) | ||
- [Invoke](#invoke) | ||
- [options](#options) | ||
- [Test Objects](#test-objects) | ||
- [Examples](#examples) | ||
- [Full Example + Docs](#full-example--docs) | ||
- [Simple Example](#simple-example) | ||
- [Inspiration](#inspiration) | ||
- [Other Solutions](#other-solutions) | ||
- [Contributors](#contributors) | ||
- [LICENSE](#license) | ||
<!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
## Installation | ||
@@ -87,3 +107,6 @@ | ||
Identifier(idPath) { | ||
idPath.node.name = idPath.node.name.split('').reverse().join('') | ||
idPath.node.name = idPath.node.name | ||
.split('') | ||
.reverse() | ||
.join('') | ||
}, | ||
@@ -106,2 +129,20 @@ }, | ||
##### babel.config.js | ||
To use [babel.config.js](https://babeljs.io/docs/en/configuration) instead of | ||
.babelrc, set babelOptions to the config object: | ||
``` | ||
pluginTester({ | ||
plugin: yourPlugin, | ||
... | ||
babelOptions: require('./babel.config.js'), | ||
... | ||
tests: [ | ||
/* your test objects */ | ||
], | ||
}); | ||
``` | ||
#### title | ||
@@ -417,3 +458,3 @@ | ||
- ESLint's [RuleTester][RuleTester] | ||
- ESLint's [RuleTester][ruletester] | ||
- [@thejameskyle][@thejameskyle]'s [tweet][jamestweet] | ||
@@ -430,4 +471,6 @@ | ||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> | ||
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub>Kent C. Dodds</sub>](https://kentcdodds.com)<br />[💻](https://github.com/babel-utils/babel-plugin-tester/commits?author=kentcdodds "Code") [📖](https://github.com/babel-utils/babel-plugin-tester/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](https://github.com/babel-utils/babel-plugin-tester/commits?author=kentcdodds "Tests") | [<img src="https://avatars3.githubusercontent.com/u/952783?v=3" width="100px;"/><br /><sub>james kyle</sub>](http://thejameskyle.com/)<br />[💻](https://github.com/babel-utils/babel-plugin-tester/commits?author=thejameskyle "Code") [📖](https://github.com/babel-utils/babel-plugin-tester/commits?author=thejameskyle "Documentation") [👀](#review-thejameskyle "Reviewed Pull Requests") [⚠️](https://github.com/babel-utils/babel-plugin-tester/commits?author=thejameskyle "Tests") | [<img src="https://avatars1.githubusercontent.com/u/1894628?v=3" width="100px;"/><br /><sub>Brad Bohen</sub>](https://github.com/bbohen)<br />[🐛](https://github.com/babel-utils/babel-plugin-tester/issues?q=author%3Abbohen "Bug reports") | [<img src="https://avatars0.githubusercontent.com/u/1295580?v=3" width="100px;"/><br /><sub>Kyle Welch</sub>](http://www.krwelch.com)<br />[💻](https://github.com/babel-utils/babel-plugin-tester/commits?author=kwelch "Code") [📖](https://github.com/babel-utils/babel-plugin-tester/commits?author=kwelch "Documentation") [⚠️](https://github.com/babel-utils/babel-plugin-tester/commits?author=kwelch "Tests") | | ||
| :---: | :---: | :---: | :---: | | ||
<!-- prettier-ignore --> | ||
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub><b>Kent C. Dodds</b></sub>](https://kentcdodds.com)<br />[💻](https://github.com/babel-utils/babel-plugin-tester/commits?author=kentcdodds "Code") [📖](https://github.com/babel-utils/babel-plugin-tester/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](https://github.com/babel-utils/babel-plugin-tester/commits?author=kentcdodds "Tests") | [<img src="https://avatars3.githubusercontent.com/u/952783?v=3" width="100px;"/><br /><sub><b>james kyle</b></sub>](http://thejameskyle.com/)<br />[💻](https://github.com/babel-utils/babel-plugin-tester/commits?author=thejameskyle "Code") [📖](https://github.com/babel-utils/babel-plugin-tester/commits?author=thejameskyle "Documentation") [👀](#review-thejameskyle "Reviewed Pull Requests") [⚠️](https://github.com/babel-utils/babel-plugin-tester/commits?author=thejameskyle "Tests") | [<img src="https://avatars1.githubusercontent.com/u/1894628?v=3" width="100px;"/><br /><sub><b>Brad Bohen</b></sub>](https://github.com/bbohen)<br />[🐛](https://github.com/babel-utils/babel-plugin-tester/issues?q=author%3Abbohen "Bug reports") | [<img src="https://avatars0.githubusercontent.com/u/1295580?v=3" width="100px;"/><br /><sub><b>Kyle Welch</b></sub>](http://www.krwelch.com)<br />[💻](https://github.com/babel-utils/babel-plugin-tester/commits?author=kwelch "Code") [📖](https://github.com/babel-utils/babel-plugin-tester/commits?author=kwelch "Documentation") [⚠️](https://github.com/babel-utils/babel-plugin-tester/commits?author=kwelch "Tests") | [<img src="https://avatars3.githubusercontent.com/u/6680299?v=4" width="100px;"/><br /><sub><b>kontrollanten</b></sub>](https://github.com/kontrollanten)<br />[💻](https://github.com/babel-utils/babel-plugin-tester/commits?author=kontrollanten "Code") | | ||
| :---: | :---: | :---: | :---: | :---: | | ||
<!-- ALL-CONTRIBUTORS-LIST:END --> | ||
@@ -475,5 +518,5 @@ | ||
[lodash.merge]: https://lodash.com/docs/4.17.4#merge | ||
[RuleTester]: http://eslint.org/docs/developer-guide/working-with-rules#rule-unit-tests | ||
[ruletester]: http://eslint.org/docs/developer-guide/working-with-rules#rule-unit-tests | ||
[@thejameskyle]: https://github.com/thejameskyle | ||
[jamestweet]: https://twitter.com/thejameskyle/status/864359438819262465 | ||
[@babel/helper-plugin-test-runner]: https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-test-runner |
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
33833
516
311