pino
pino copied to clipboard
Restore and automate airtap testing
Currently our npm run browser-test is not working anymore.
I've tried to adding it back via playwright, but stumbled on:
# fatal logs
client error (Playwright Chromium): {
message: 'Uncaught TypeError: Cannot redefine property: error',
source: 'http://localhost:52401/airtap/test.js',
lineno: 15382,
colno: 10,
error: {
name: 'TypeError',
stack: 'TypeError: Cannot redefine property: error\n' +
' at Function.defineProperty (<anonymous>)\n' +
' at sink (http://localhost:52401/airtap/test.js:15382:10)\n' +
' at Test.<anonymous> (http://localhost:52401/airtap/test.js:15257:5)\n' +
' at Test.run (http://localhost:52401/airtap/test.js:12264:28)\n' +
' at next (http://localhost:52401/airtap/test.js:12055:7)\n' +
' at onNextTick (http://localhost:52401/airtap/test.js:13194:12)\n' +
' at Item.run (http://localhost:52401/airtap/test.js:8197:14)\n' +
' at drainQueue (http://localhost:52401/airtap/test.js:8167:42)'
}
}
This the config file I'm trying:
➜ pino git:(main) ✗ cat .airtap.yml
providers:
- airtap-playwright
browsers:
- name: chromium
cc @vweevers
Both the pino test and airtap override console.error (here and here). Airtap wraps and calls the original function so that should not be a problem. Pino only intercepts a single call and then restores the original function, which I think should work fine as well. Both use simple assignment (console.error = x). Hm.
Would recommend debugging it, which is easiest with a non-headless browser, e.g. using airtap-default.
Where does airtap does the wrapping? Might it be that it defines the fields in a non-writable way?
https://github.com/airtap/airtap/blob/034a6cf5c0f0014c94ac7f83b19fee69eda218e4/client/index.js#L43