简体   繁体   中英

How to configure Jest in HTML file for integration tests?

I want to use integration tests that will use an external API. The external library is loaded on the fly by implementing it's URL (like google ads). So, I need to start the tests from the stage, I think. How can I configure them properly? For example, there is a Jasmine integration HTML part that I found

<script type="text/javascript" src="node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script>
<script type="text/javascript" src="node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script>
<script type="text/javascript" src="node_modules/jasmine-core/lib/jasmine-core/boot.js"></script>

But what should I add for Jest testing without mocks?

UPD: Ok, can I run Jest test framework without command line? In browser?

The answer from Jest chat:

Jest is not an end to end testing framework, it cannot run in a browser. I think your best options are Cypress which is an end to end framework that runs in Chrome, or Puppetteer if you just want to manually control a browser in Jest tests.

If I understand you correctly you want to run on a staging/production environment directly? Definitely Cypress in that case

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM