robin1liu / vue-mermaid

flowchart of mermaid with vue component
MIT License
124 stars 25 forks source link

Cannot execute unit tests with Jest when vue-mermaid is used #23

Closed ikolomiyets closed 3 years ago

ikolomiyets commented 3 years ago

When I am trying to unit test a component that uses vue-mermaid test fails to run with the following error: ` ● Test suite failed to run

ReferenceError: define is not defined

  4 | import Vuex from 'vuex';
  5 | import Vue from 'vue';
> 6 | import VueMermaid from 'vue-mermaid';
    | ^
  7 | import axios from 'axios';

  at Object.<anonymous> (node_modules/vue-mermaid/dist/vue-mermaid.js:1:31)
  at Object.<anonymous> (tests/unit/components/dashboard/flows/flow/flowDetails/FlowDetails.spec.js:6:1)

`

It appears that it is due to the fact that vue-mermaid module does not conform UMD which Jest requires.