Best Practices·续1

This package makes testing plugins easier. If you’re familiar with ESLint’s RuleTester this should be familiar. You can look at the docs to get a full sense of what’s possible, but here’s a simple example:

import pluginTester from 'babel-plugin-tester';import identifierReversePlugin from '../identifier-reverse-plugin';pluginTester({  plugin: identifierReversePlugin,  fixtures: path.join(__dirname, '__fixtures__'),  tests: {    'does not change code with no identifiers': '"hello";',    'changes this code': {      code: 'var hello = "hi";',      output: 'var olleh = "hi";',    },    'using fixtures files': {      fixture: 'changed.js',      outputFixture: 'changed-output.js',    },    'using jest snapshots': {      code: `        function sayHi(person) {          return 'Hello ' + person + '!'        }      `,      snapshot: true,    },  },});