---
title: "PDF SDK test integration | Nutrient"
canonical_url: "https://www.nutrient.io/guides/web/troubleshooting/testing-troubleshooting/"
md_url: "https://www.nutrient.io/guides/web/troubleshooting/testing-troubleshooting.md"
last_updated: "2026-06-09T10:25:14.556Z"
description: "Solutions for common issues and errors in Nutrient Web SDK with debugging tips and workarounds."
---

This article lists common issues that might occur while integrating Nutrient Web SDK into your test suites.

## Certain APIs are not defined

Nutrient Web SDK makes use of multiple Web APIs. Some of them might not be present on a standard Node.js runtime or provided by DOM emulation environments such as [jsdom](https://github.com/jsdom/jsdom), which is used by default on testing frameworks such as [Jest](https://jestjs.io/en/).

While integrating Nutrient Web SDK with your tests, you might see an error like the following:

```

ReferenceError: x is not defined on import PSPDFKit from 'pspdfkit'.

```

Here, `x` might be a reference to some standard DOM API member, and this means the Node.js environment your test suite is running on does not support it.

In this case, you’ll need to provide a mock for the missing member. You can either create a mock by yourself or look into an open source mock implementation for the missing API.

As an example, if you’re using Jest for your tests and observe a `TextMetrics is not defined` error, you can add the [`jest-canvas-mock`](https://github.com/hustcc/jest-canvas-mock) package to your project and the error should be gone, since that package contains mocks for `canvas` and related APIs, including `TextMetrics`.
---

## Related pages

- [Content Security Policy](/guides/web/troubleshooting/content-security-policy.md)
- [Bug Reporting](/guides/web/troubleshooting/bug-reporting.md)
- [This will make the current directory contents available through `http://0.0.0.0:5000`.](/guides/web/troubleshooting/common-issues.md)
- [Chunkloaderror During Pspdfkit To Nutrient Migration In Ember](/guides/web/troubleshooting/chunkloaderror-during-pspdfkit-to-nutrient-migration-in-ember.md)
- [Fixing Split Undefined Error With Npm Build](/guides/web/troubleshooting/fixing-split-undefined-error-with-npm-build.md)
- [Fixing Symbol Iterator Error](/guides/web/troubleshooting/fixing-symbol-iterator-error.md)
- [Debug Logging](/guides/web/troubleshooting/debug-logging.md)
- [npm](/guides/web/troubleshooting/nightlies.md)
- [Typescript](/guides/web/troubleshooting/miscellaneous/typescript.md)
- [Webassembly Simd Support](/guides/web/troubleshooting/webassembly-simd-support.md)

