# Error importing @zoom/videosdk in Jest

**URL:** <https://devforum.zoom.us/t/error-importing-zoom-videosdk-in-jest/61114>\
**Category:** Web\
**Created:** [December 6, 2021, 3:07pm UTC](https://devforum.zoom.us/t/error-importing-zoom-videosdk-in-jest/61114 "2021-12-06T15:07:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bee](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bee/32/33124_2.png) [@Bee](https://devforum.zoom.us/u/Bee)\
**Post date:** [December 6, 2021, 3:07pm UTC](https://devforum.zoom.us/t/error-importing-zoom-videosdk-in-jest/61114/1 "2021-12-06T15:07:02Z")

</div>

**Description**

Hi, 👋, I’m getting an error when running Jest (jsdom) test and I try to import @zoom1234/videosdk.

**Browser Console Error**

```
Test suite failed to run

TypeError: Cannot read property 'subtle' of undefined

> 1 | import ZoomVideo from '@zoom/videosdk';
    | ^
  2 | import { eventNames } from '../../events';
  3 | import type { SurfaceType } from '../../surface';
  4 | import { generateVideoToken } from './video-call-auth';

  at Object.<anonymous> (node_modules/@zoom/videosdk/dist/index.js:1:100082)
  at Object.<anonymous> (src/interface/video-calls/video-call.js:1:1)

```

**Which Web Video SDK version?**

1.1.6

**Video SDK Code Snippets**  
The code snippets that are causing the error / issue so we can reproduce.

**To Reproduce(If applicable)**  
Steps to reproduce the behavior:

1. Go to ‘…’
2. Click on ‘…’
3. Scroll down to ‘…’
4. See error

**Screenshots**  
If applicable, add screenshots to help explain your problem.

**Device (please complete the following information):**

- Device: Macbook Pro & Codeship
- OS: macOS 11.6, Unbutu linux
- Browser: Chrome
- Browser Version: Version 95.0.4638.69 (Official Build) (x86\_64)

**Additional context**  
Add any other context about the problem here.

---

<div class="post-metadata">

**Author:** ![nickuk](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/nickuk/32/31345_2.png) [@nickuk](https://devforum.zoom.us/u/nickuk)\
**Post date:** [December 6, 2021, 4:01pm UTC](https://devforum.zoom.us/t/error-importing-zoom-videosdk-in-jest/61114/2 "2021-12-06T16:01:44Z")

</div>

Hey @Bee ,

What version of Node JS are you using?

Just looking here [Crypto.subtle - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/subtle) and that’s only available in version 15.0+ of Node. Assuming Crypto.subtle is what’s falling over in the zoom code.

Cheers,  
Nick

---

<div class="post-metadata">

**Author:** ![Bee](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bee/32/33124_2.png) [@Bee](https://devforum.zoom.us/u/Bee)\
**Post date:** [December 6, 2021, 8:16pm UTC](https://devforum.zoom.us/t/error-importing-zoom-videosdk-in-jest/61114/3 "2021-12-06T20:16:38Z")

</div>

I was using node version 12.22.0 when I posted. Switched to 15.14.0. Same error.

---

<div class="post-metadata">

**Author:** ![Bee](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bee/32/33124_2.png) [@Bee](https://devforum.zoom.us/u/Bee)\
**Post date:** [December 7, 2021, 2:22pm UTC](https://devforum.zoom.us/t/error-importing-zoom-videosdk-in-jest/61114/4 "2021-12-07T14:22:51Z")

</div>

Also tried node version 16.13.1. Same error. Jest version is 27.2.4.

---

<div class="post-metadata">

**Author:** ![Bee](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bee/32/33124_2.png) [@Bee](https://devforum.zoom.us/u/Bee)\
**Post date:** [December 7, 2021, 2:54pm UTC](https://devforum.zoom.us/t/error-importing-zoom-videosdk-in-jest/61114/5 "2021-12-07T14:54:21Z")

</div>

I ended up creating a module mock for videosdk. See, [javascript - Jest: How to globally mock node-uuid (or any other imported module) - Stack Overflow](https://stackoverflow.com/questions/47487766/jest-how-to-globally-mock-node-uuid-or-any-other-imported-module)

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [December 9, 2021, 10:54pm UTC](https://devforum.zoom.us/t/error-importing-zoom-videosdk-in-jest/61114/6 "2021-12-09T22:54:12Z")

</div>

Hey @Bee ,

Did you get it working with that approach? @nickuk , thanks for the suggestion here! 🙂

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [January 9, 2022, 8:54am UTC](https://devforum.zoom.us/t/error-importing-zoom-videosdk-in-jest/61114/7 "2022-01-09T08:54:40Z")

</div>

Closed on January 9, 2022, 8:54am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
