test: added test for playwright-core#184
Conversation
|
Update: I went through the latest releases until 0.1.7 and it all of them the file was not added. Still not sure if its a bug in that repo or as-designed. |
|
Thanks for digging into this one! I was able to reproduce the bug. Replacing the readFileSync with require works. - const browsersJSON = JSON.parse(fs_1.default.readFileSync(path_1.default.join(packagePath, 'browsers.json'), 'utf8'));
+ const browsersJSON = require(path_1.default.join(packagePath, 'browsers.json'));My first thought is that Needs a little more investigation to fix. Would you like to fix it in nft? 🙂 |
|
Yup will take a look, I keep you posted. 👍 |
861576f to
eba8499
Compare
|
I think I was able to simplify the test-case as small as it can get. Unfortunately I have to give away my notebook today and then get a new one in a few days since I'm switching jobs. Also I tried to dig into it and spend a few hours but was not sure about the internals how the matching works. Would be awesome if you could take over, with the small repro it should be easier to find the root cause. Thanks! |
|
|
||
| class Foobar { | ||
| constructor(packagePath) { | ||
| console.log(fs.readFileSync(path.join(packagePath, 'asset1.txt'), 'utf8')) |
There was a problem hiding this comment.
I tried changing readFileSync to require and that doesn't work either. So there must be something different about the npm package that made it work with require but fail with readFileSync 🤔
This PR adds a test to demonstrate a current issue which was reported here.
TL;DR: The following file does not get added:
node_modules/playwright-core/browsers.jsonSee here for more information and background: microsoft/playwright#5862
The relevant part in the code is the
fs.readFileSyncwhich does not get detected. If you userequireinstead it works and it does get added.
The following line is the relevant one in Playwright, if it does get changed to
requireinstead, it does pass the test. (change it innode_modules/playwright-core/lib/utils/registry.jsfor local testing)https://github.com/microsoft/playwright/blob/e81a3c5901e024f7c41edf023daad60c68ed093d/src/utils/registry.ts#L238
This was probably a recently introduced bug which breaks the usage of Playwright on Vercel serverless functions. It worked a few months ago. On Playwright side a few users faced already into this bug.