From 4595c7fdfd96a3ffe50ce14921e67adbd6e8ff99 Mon Sep 17 00:00:00 2001 From: Vinh Le Date: Sat, 21 Apr 2018 22:35:48 +0700 Subject: [PATCH] Correct test running command (#7768) [skip ci] * Correct test running command * Also refine test/index.js content --- packages/babel-helper-plugin-test-runner/README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/babel-helper-plugin-test-runner/README.md b/packages/babel-helper-plugin-test-runner/README.md index 6d7ba045eb..435725f12a 100644 --- a/packages/babel-helper-plugin-test-runner/README.md +++ b/packages/babel-helper-plugin-test-runner/README.md @@ -6,8 +6,12 @@ > 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 `require("@babel/helper-plugin-test-runner")(__dirname);`. +1. Inside a `/test` directory, add an `index.js` with the contents +```js +import runner from "@babel/helper-plugin-test-runner"; + +runner(__dirname); +``` 2. Inside `/test/fixtures`, create a folder for each suite (eg; one suite for each feature of your plugin). 3. 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. Install and run `mocha`. -4. To run a specific test, run `mocha --grep testName`. +3. To run a specific test, run `TEST_GREP=testName make test`. [Read more](https://github.com/babel/babel/blob/master/CONTRIBUTING.md#running-lintingtests).