babel-plugin-tester icon indicating copy to clipboard operation
babel-plugin-tester copied to clipboard

Document how to test a preset

Open drzraf opened this issue 5 years ago • 1 comments

Problem description:

plugin and pluginName are plugin-centric. I would like to test a preset which bundle a couple of plugins.

Suggested solution:

Could you please document how to do that (if it's possible)?

drzraf avatar Feb 01 '20 20:02 drzraf

This isn't directly supported, but it could be (I don't think it would take too much work). Would you be interested in making a pull request to add this feature?

kentcdodds avatar Feb 02 '20 03:02 kentcdodds

I'm thinking a new set of options: preset, presetName ~~(required)~~, and presetOptions. This set of options would be mutually exclusive with the counterpart set: plugin, pluginName, and pluginOptions. If any of the options from one set are used, options from the other set cannot be used.

From there, it's just a matter of wiring up [preset, presetOptions] to be injected into the final babelOptions (babelOptions.presets rather than babelOptions.plugins) and using presetName ~~(which would be non-optional)~~ in the describe block instead of pluginName. Given #91, it'd be prudent to export a new symbol for supporting an arbitrary run order of the preset under test too.

I'll work on a PR for this.

Xunnamius avatar Oct 02 '22 22:10 Xunnamius