I'm attempting to use Elio and Velin's guidance on creating unit tests for the SharePoint framework. Both appear to work great for vanilla components, but I'm running into problems when trying to incorporate an external dependency.

Here is the error I get when trying to run a HelloWorld-type test on my SPFx web part. enter image description here

This is the dependency it's complaining about, located in my config.json file. enter image description here

Here is the relevant piece of my package.json. (It did not format well when I tried to post it all as code.)

enter image description here

And here are some npm warnings I'm getting in the console. (I think they might be related to my problem.)
enter image description here

Full disclosure: I'm a SharePoint dev learning the SPFx, and newbie to webpack, npm, and nodejs. From Googling, I found the following GitHub issues which indicate the problem might be webpack related?

Thanks! :-)

1 Answer 1


you can add the jsChart to the devDependencies in package.json and also keep it in the external dependency configuration. Doing that the tests will run and in the same time the jsChart would not be bundled with the packages, but the packages will use your external dependency. Hope that clears your ask.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.