Use babel-node
instead of ts-node
when running benchmark script
Summary: `ts-node` does transformation using tsc. Do transformation with Babel instead so that the generation is consistent with Jest and the packed output. We still need `ts-node` around since various systems rely on it being present to enable `.ts` config files. This also enables transformation of any JS files. Reviewed By: yungsters Differential Revision: D45722106 fbshipit-source-id: 51b7a4f6a1532bea1133d59e626297d3b40f1762
This commit is contained in:
committed by
Facebook GitHub Bot
parent
82096a1465
commit
e409bfb43a
@@ -139,13 +139,25 @@ function babelTransformTask(opts: {dir: string}) {
|
||||
function runBenchTask() {
|
||||
return () => {
|
||||
const files = glob.sync('./tests/Benchmarks/**/*');
|
||||
const args = ['./tests/bin/run-bench.ts', ...files];
|
||||
logger.info(args.join(' '));
|
||||
|
||||
return spawn(node, args, {
|
||||
const args = [
|
||||
'--extensions',
|
||||
'.js,.ts',
|
||||
'--config-file',
|
||||
path.join(__dirname, '.babelrc.js'),
|
||||
'--',
|
||||
'./tests/bin/run-bench.ts',
|
||||
...files,
|
||||
];
|
||||
logger.info(['babel-node', ...args].join(' '));
|
||||
|
||||
return spawn(
|
||||
node,
|
||||
[require.resolve('@babel/node/bin/babel-node'), ...args],
|
||||
{
|
||||
stdio: 'inherit',
|
||||
env: {NODE_OPTIONS: '-r ts-node/register'},
|
||||
});
|
||||
},
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -44,6 +44,7 @@
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.7",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/node": "^7.20.7",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-typescript": "^7.21.4",
|
||||
"@types/glob": "^8.1.0",
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user