-
Notifications
You must be signed in to change notification settings - Fork 2
Description
First, I want to say that I am really happy I found this library! I am surprised that it doesn't have more stars. Being able to benchmark Javascript code on different platforms is really great, and I was having trouble finding any tools that would do that. (I was worried I would have to try to build my own). Tachometer is another option but it only supports web browsers and requires all Javascript code to be within HTML files.
summary
When I try to run npm run benchmark on Windows after following the getting started instructions, the cli.js file is opened in my IDE instead of being executed.
I discovered that the npm documentation says the following:
Please make sure that your file(s) referenced in bin starts with #!/usr/bin/env node; otherwise, the scripts are started without the node executable!
I checked how some other libraries do it, and they add the above annotation in their bin files.
#!/usr/bin/env node
require('../lib/tsc.js')workaround
I am using the command node node_modules\esbench\lib\host\cli.js to bypass the npm shim to call the package directly.
additional details
npm uses cmd-shim to generate a esbench.cmd file inside of node_modules/.bin. Below is a comparison of the generated files for esbench vs typescript:
esbench.cmd
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
"%dp0%\..\esbench\lib\host\cli.js" %*tsc.cmd
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\typescript\bin\tsc" %*