@babel/helper-plugin-test-runner
Usage:
tip
Check Babel for an example: https://github.com/babel/babel/tree/main/packages/babel-plugin-transform-exponentiation-operator/test
- Inside a
/testdirectory, add anindex.jswith the contents
JavaScript
import runner from "@babel/helper-plugin-test-runner";
runner(__dirname);
- Inside
/test/fixtures, create a folder for each suite (eg; one suite for each feature of your plugin). - Suite folders may contain files and folders. Files will be transformed and run; use
expect()assertions to verify correct behavior. Folders may containinput.js,output.js, and/orexec.js. The output of transforminginput.jswill be checked to match the contents ofoutput.js.exec.js, if it exists, will be transformed and run, as with a file in the suite folder. - To run a specific test, run
TEST_GREP=testName make test. Read more.