nodejs / corepack

Zero-runtime-dependency package acting as bridge between Node projects and their package managers
MIT License
2.52k stars 165 forks source link

test: store nocks in a sqlite database #374

Closed merceyz closed 7 months ago

merceyz commented 7 months ago

Storing the nocks in a SQLite database enables easily sharing nocks between tests run in different processes in parallel.

This reduces the storage space needed for the nocks:

$ du tests/nock
- 186700  tests/nock
+  48968  tests/nock

It avoids the v8.serialize / v8.deserialize issues encountered in https://github.com/nodejs/corepack/pull/365.

The database is portable so the version of Node.js used to generate it doesn't matter.

merceyz commented 7 months ago

I wonder if this approach will not introduce a conflict-hell, if virtually all PRs will touch the same binary file.

Yeah, that's the downside of this approach, any new nock will cause a conflict. However since nocks can be re-used between tests it's possible the nock is already in the database. If it becomes too much we can always add some automation to handle it.