jasmine / jasmine-browser-runner

Serve and run your Jasmine specs in a browser
49 stars 23 forks source link

How to use external library loaded into the global scope? #34

Closed duvifn closed 1 year ago

duvifn commented 1 year ago

Hi, I'm now trying jasmine in browser to test library that can run only in browser.

My question: In rollup and other build environments, there is an option to indicate usage of global libraries that are loaded using <script> tag in the webpage. How can I include such a global in the spec so it would be loaded by the jasmine into the webpage during the spec running?

sgravrock commented 1 year ago

You can add the URL to srcFiles in your config file, e.g.:

  "srcFiles": [
    "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js",
    "**/*.js"
  ],
duvifn commented 1 year ago

Thanks a lot, @sgravrock! This works to me.