question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Run each set of tests in separate iframe

See original GitHub issue

This would make karma also superb for integration (and such) tests. As they can easily pollute global variables or fixtures.

This would be awesome to have files variable in config file to accept something like:

files = [
    ['file.js', 'file.spec.js'],
    ['lib.js', 'lib.spec.js']
]

or an object

files = {
    'fileTest': ['file.js', 'file.spec.js'],
    'libTest': ['lib.js', 'lib.spec.js']
}

so you could name each set

and each array would be set of files to be loaded in a separate iframe so you would not have to worry about polluting environment and just focus on integration tests itself

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Reactions:1
  • Comments:24 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
bashmishcommented, Dec 9, 2018

This might be really helpful when testing custom elements (web components). For now there is only one single registry and no way to unregister an element. Though there is this idea to have scoped registries which does not have a concrete proposal yet.

This old discussion about the possibility to unregister didn’t go further than pointing out that there are test frameworks which already run tests in iframes, which is the web-component-tester. But web-component-tester is also very limited and only allows running individual suites in iframes, not individual tests. I created a repo to show this behavior. Looks like the above mentioned karma-iframes is similar to the WCT behavior.

I can understand that this use case is not trivial. But maybe it is time to reconsider and reopen the issue at least to explore possible use-cases further.

3reactions
lancediksoncommented, Mar 8, 2019

I’m currently having the same situation with custom elements (Web Components) testing and struggling with setting up integration and unit tests, where each component can be registered only once and there’s no way to unregister it. It produces very specific workarounds after all. Let’s try to call active maintainers to re-check this issue and maybe re-open it because the problem is getting more and more common due to the growing popularity of WebComponents. @johnjbarton 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

unit testing JS app with page reloads and iframes
On the other hand, the kind of unit tests you shown are meant to test separate units of the program such as controllers,...
Read more >
IFrame Testing: The Essential Guide - Testim.io
If you need to test IFrames, you know it's tricky. Find out some strategies for IFrame testing, and some pitfalls to avoid.
Read more >
How to make your site believe it isn't running in an iframe ...
The limitation is that it runs all tests within an iframe. This iframe approach makes sense, as it allows the tool to show...
Read more >
iFrames in Selenium WebDriver - Tools QA
An iframe is a space on the web page that embeds different kinds of media like images, documents, videos inside the main web...
Read more >
How To Handle iFrames In Cypress | Cypress Advanced Tutorial
An inline frame ( iframe ) is an HTML element that contains another HTML ... How To Run Cypress Tests In Headless Mode:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found