A Babel Plugin for TestUS
The whole plugin complies with the architectural design system of Babel
, and performs corresponding syntax transformation on the source code through procedural steps.
The technical selection uses various dependency packages required by Babel
to handle Babel 6.x and Babel 7.x, including: parser
, traverse
, and generator
etc.
By configuring the plugins
in babel.config.js
or .babelrc
, introduce babel-plugin-testus
to realize syntax transformation. The configuration is as follows:
// babel.config.js
module.exports = {
"plugins": [
"babel-plugin-testus"
]
}
Before:
// @testus
const sum = (a,b) => a+b;
After:
/**
* @testus
* @name sum
* @param a
* @param b
* @testus
*/
const sum = (a,b) => a+b;
Copyright (c) 2023-present VLeeDesignTheory