Skip to content

Instantly share code, notes, and snippets.

@rwaldron
Created October 2, 2018 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwaldron/da2f77605925f5092c0ccad3384f074a to your computer and use it in GitHub Desktop.
Save rwaldron/da2f77605925f5092c0ccad3384f074a to your computer and use it in GitHub Desktop.
mkdir test262-transformers
export TRANSFORMERS=$PWD/test262-transformers
cd test262-transformers
npm init -y
npm install --save @babel/core @babel/preset-env
touch spec.js 

Copy the contents to spec.js into your local spec.js

const babel = require("@babel/core");
const options = {
cwd: __dirname,
presets: [
[
"@babel/preset-env",
{
spec: true
}
]
]
};
module.exports = function(code) {
let c = babel.transform(code, options).code;
console.log(c);
return c;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment