babel-plugin-tester
babel-plugin-tester copied to clipboard
Document how to test a preset
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)?
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?
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.