mbalabash / estimo

Evaluates how long a browser will execute your javascript code
MIT License
170 stars 12 forks source link

TypeError: Cannot read properties of undefined (reading 'javaScript') #40

Closed unional closed 1 year ago

unional commented 1 year ago

On WSL With Node 18.12.1 With puppeteer 13.7.0 With estimo 2.3.6 With size-limit 8.0.1

Error: Failed to launch the browser process! spawn /home/homa/code/mocktomata/node_modules/.pnpm/estimo@2.3.6/node_modules/estimo/temp/chrome/linux-982053/chrome-linux/chrome ENOENT

✖ Running JS in headless Chrome
ERROR  TypeError: Cannot read properties of undefined (reading 'javaScript')
  at getTime (/home/homa/code/mocktomata/mocktomata/node_modules/.pnpm/@size-limit+time@8.0.1_size-limit@8.0.1/node_modules/@size-limit/time/get-running-time.js:29:22)

on this line:

// get-running-time.js from `size-limit`
let estimo = require('estimo')

...
  perf = await estimo(file)
  value += perf[0].javaScript / 1000

Seems like estimo returns an empty array perf = [] for the file /tmp/size-limit-DnCRqgCfYvwJ1rc8ocpJI/index.js

In what case it will return empty?

Reference https://github.com/ai/size-limit/issues/310

mbalabash commented 1 year ago

Closed due to a resolution in the original issue.

unional commented 1 year ago

The upstream is closed by doing a workaround (by not using this package). The issue still exist in this package thou.