Bumps [glob](https://github.com/isaacs/node-glob) from 8.0.3 to 8.1.0. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/isaacs/node-glob/blob/main/changelog.md">glob's changelog</a>.</em></p> <blockquote> <h2>8.1</h2> <ul> <li>Add <code>windowsPathsNoEscape</code> option</li> </ul> <h2>8.0</h2> <ul> <li>Only support node v12 and higher</li> <li><code>\</code> is now <strong>only</strong> used as an escape character, and never as a path separator in glob patterns, so that Windows users have a way to match against filenames containing literal glob pattern characters.</li> <li>Glob pattern paths <strong>must</strong> use forward-slashes as path separators, since <code>\</code> is an escape character to match literal glob pattern characters.</li> <li>(8.0.2) <code>cwd</code> and <code>root</code> will always be automatically coerced to use <code>/</code> as path separators on Windows, as they cannot contain glob patterns anyway, and are often supplied by <code>path.resolve()</code> and other methods that will use <code>\</code> path separators by default.</li> </ul> <h2>7.2</h2> <ul> <li>Add fs option to allow passing virtual filesystem</li> </ul> <h2>7.1</h2> <ul> <li>Ignore stat errors that are not <code>ENOENT</code> to work around Windows issues.</li> <li>Support using root and absolute options together</li> <li>Bring back lumpy space princess</li> <li>force 'en' locale in string sorting</li> </ul> <h2>7.0</h2> <ul> <li>Raise error if <code>options.cwd</code> is specified, and not a directory</li> </ul> <h2>6.0</h2> <ul> <li>Remove comment and negation pattern support</li> <li>Ignore patterns are always in <code>dot:true</code> mode</li> </ul> <h2>5.0</h2> <ul> <li>Deprecate comment and negation patterns</li> <li>Fix regression in <code>mark</code> and <code>nodir</code> options from making all cache keys absolute path.</li> <li>Abort if <code>fs.readdir</code> returns an error that's unexpected</li> <li>Don't emit <code>match</code> events for ignored items</li> <li>Treat ENOTSUP like ENOTDIR in readdir</li> </ul> <h2>4.5</h2> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="1b6bf20239"><code>1b6bf20</code></a> 8.1.0</li> <li><a href="1756fccfe7"><code>1756fcc</code></a> add windowsPathsNoEscape option</li> <li><a href="af57da21c7"><code>af57da2</code></a> update tap, libtap</li> <li><a href="e19db65d23"><code>e19db65</code></a> Remove dependency on path-is-absolute</li> <li>See full diff in <a href="https://github.com/isaacs/node-glob/compare/v8.0.3...v8.1.0">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Puppeteer tests
Unit tests in Puppeteer are written using Mocha as the test runner and Expect as the assertions library.
Test state
We have some common setup that runs before each test and is defined in mocha-utils.js.
You can use the getTestState function to read state. It exposes the following that you can use in your tests. These will be reset/tidied between tests automatically for you:
puppeteer: an instance of the Puppeteer library. This is exactly what you'd get if you ranrequire('puppeteer').puppeteerPath: the path to the root source file for Puppeteer.defaultBrowserOptions: the default options the Puppeteer browser is launched from in test mode, so tests can use them and override if required.server: a dummy test server instance (seepackages/testserverfor more).httpsServer: a dummy test server HTTPS instance (seepackages/testserverfor more).isFirefox: true if running in Firefox.isChrome: true if running Chromium.isHeadless: true if the test is in headless mode.
If your test needs a browser instance, you can use the setupTestBrowserHooks() function which will automatically configure a browser that will be cleaned between each test suite run. You access this via getTestState().
If your test needs a Puppeteer page and context, you can use the setupTestPageAndContextHooks() function which will configure these. You can access page and context from getTestState() once you have done this.
The best place to look is an existing test to see how they use the helpers.
Skipping tests in specific conditions
To skip tests edit the TestExpecations file. See test runner documentation for more details.
Running tests
- To run all tests applicable for your platform:
npm test
- Important: don't forget to first build the code if you're testing local changes:
npm run build && npm test
- To run a specific test, substitute the
itwithit.only:
...
it.only('should work', async function() {
const {server, page} = getTestState();
const response = await page.goto(server.EMPTY_PAGE);
expect(response.ok).toBe(true);
});
- To disable a specific test, substitute the
itwithit.skip:
...
it.skip('should work', async function({server, page}) {
const {server, page} = getTestState();
const response = await page.goto(server.EMPTY_PAGE);
expect(response.ok).toBe(true);
});
- To run Chrome headful tests:
npm run test:chrome:headful
- To run tests with custom browser executable:
BINARY=<path-to-executable> npm run test:chrome:headless # Or npm run test:firefox