diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a40178380d293..344b75fb24b3b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -292,12 +292,16 @@ The following steps are needed to update the Chromium version. ### Bisecting upstream changes -Sometimes, performing a Chromium roll causes tests to fail. To figure out the cause, you need to bisect Chromium revisions to figure out the earliest possible revision that changed the behavior. The script in `utils/bisect.js` can be helpful here. Given a Node.js script that calls `process.exit(1)` for bad revisions, run this from the Puppeteer repository’s root directory: +Sometimes, performing a Chromium roll causes tests to fail. To figure out the cause, you need to bisect Chromium revisions to figure out the earliest possible revision that changed the behavior. The script in `utils/bisect.js` can be helpful here. Given a pattern for one or more unit tests, it will automatically bisect the current range: ```sh node utils/bisect.js --good 686378 --bad 706915 script.js + +node utils/bisect.js --unit-test Response.fromCache ``` +By default, it will use the Chromium revision in `src/revisions.ts` from the `main` branch and from the working tree to determine the range to bisect. + ## Releasing to npm Releasing to npm consists of the following phases: diff --git a/utils/bisect.js b/utils/bisect.js index d81fdec8f5908..60b7ba07c61d5 100755 --- a/utils/bisect.js +++ b/utils/bisect.js @@ -21,7 +21,7 @@ const pptr = require('..'); const browserFetcher = pptr.createBrowserFetcher(); const path = require('path'); const fs = require('fs'); -const { fork } = require('child_process'); +const { fork, spawn, execSync } = require('child_process'); const COLOR_RESET = '\x1b[0m'; const COLOR_RED = '\x1b[31m'; @@ -35,12 +35,16 @@ Usage: node bisect.js --good --bad