Skip to content

Troubleshooting and FAQ#

Visual tests and Vitest browser mode#

Screenshot tests run with Vitest browser mode and use Playwright as the browser provider under the hood. The helper in core/vitest-screenshots/ drives a single Firefox page per worker against the running portal on http://localhost:8000. The screenshot config sets fileParallelism: true, so test files run in parallel across workers while tests inside a file run sequentially on the same page.

Installing screenshot browser#

For running screenshot tests (visual tests), a headless Firefox browser is needed.

In normal circumstances, the browser will be installed automatically via yarn install – but to either upgrade to a newer version, or to wipe out existing versions and run the install manually, you can run these commands, depending on your needs:

yarn workspace @dnb/eufemia playwright uninstall --all
yarn workspace @dnb/eufemia add -D @playwright/test
yarn workspace @dnb/eufemia playwright install firefox
yarn workspace dnb-design-system-portal playwright uninstall --all
yarn workspace dnb-design-system-portal add -D @playwright/test
yarn workspace dnb-design-system-portal playwright install firefox

Alternative install: behind a corporate proxy#

A proxy that re-signs HTTPS traffic can make the install fail with Error: unable to get local issuer certificate. Point Node.js to your organization's root certificate (a PEM file from your IT department) and run the install again:

NODE_EXTRA_CA_CERTS=/path/to/root-ca.pem yarn workspace @dnb/eufemia playwright install firefox

Alternative install: manually#

Or, in the very worst case, you can manually download the zip file that yarn workspace @dnb/eufemia playwright install firefox attempts to download, and extract the file ("Nightly" for Firefox) to the folder indicated when yarn test:screenshots fails.

How can I run all screenshot tests without stopping on first failure?#

By default, CI runs only affected screenshot tests based on changed files and reverse dependencies. If a global style change is detected, all screenshot tests are run.

To force all screenshot tests and continue after failures, include --run-all in your commit message:

git commit -m "feat: implement new feature --run-all"

This disables --bail and runs all screenshot tests, so you can see all visual differences at once.

The CI/CD pipeline automatically detects this flag and adjusts the test behavior accordingly.

What does build:mini do?#

When running build:mini scripts, the build will be faster and the output will be smaller. It's used for the CI/CD pipeline to build the package for the documentation preview.

Dependency issues#

Yarn patches#

  • We patch eslint-plugin-import-x 4.17.1 so that it works with minimatch 11. The root resolutions move minimatch 9 and 10 to 11 for a security fix, and minimatch 11 no longer exports makeRe, which the plugin's no-internal-modules rule imports. Without the patch, ESLint fails to start with does not provide an export named 'makeRe'. The patch is a port of un-ts/eslint-plugin-import-x#570. It lives in .yarn/patches/ and is applied by the eslint-plugin-import-x@npm:4.17.1 entry in the root resolutions. Remove the patch and that entry when a plugin release includes the fix. If you change the plugin version, yarn lint:resolutions fails until you update or remove the entry.

Babel#

Suggest an edit
Eufemia · /web/contribute/faq/ · Version 11.18.1