babel/packages/babel-helper-plugin-test-runner
2018-05-14 17:15:44 -07:00
..
2017-03-25 21:46:16 -04:00
2018-05-14 17:15:44 -07:00

@babel/helper-plugin-test-runner

NOTE: This is an internal Babel module and may not work outside. Use at your own risk.

Usage:

Check Babel for an example: https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-exponentiation-operator/test

  1. Inside a /test directory, add an index.js with the contents
import runner from "@babel/helper-plugin-test-runner";

runner(__dirname);
  1. Inside /test/fixtures, create a folder for each suite (eg; one suite for each feature of your plugin).
  2. Suite folders may contain files and folders. Files will be transformed and run; use expect() assertions to verify correct behavior. Folders may contain input.js, output.js, and/or exec.js. The output of transforming input.js will be checked to match the contents of output.js. exec.js, if it exists, will be transformed and run, as with a file in the suite folder.
  3. To run a specific test, run TEST_GREP=testName make test. Read more.