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.

Allow inserting source files in the HEAD / custom context.html

See original GitHub issue

Based on #430

Let’s allow custom context.html and debug.html.

Add two config options:

  • contextFile (default __dirname + ‘…/static/context.html’)
  • debugContextFile (default __dirname + ‘…/static/debug.html’)

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:38 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
dignifiedquirecommented, Mar 3, 2016

Done in #1825

0reactions
rosenfeldcommented, Feb 10, 2016

I believe there are many reasons why allowing custom HTML would be desirable. It gives other projects flexibility to do basically any kind of experimentation with Karma without having to fork the project.

In our specific case, we use oojspec to run unit and integration tests with a single runner. Most integration test runners out there are pretty slow, like Capybara, Selenium or anything using a real browser, headless like phantomjs or not.

OOJSpec doesn’t enforce the way people should write code. If someone wants to be able to register events on DOM selectors which are never unregistered because it’s not needed in the application, they shouldn’t change the way they write their code just to satisfy their test runner limitations. So, one is free to register those events once in a beforeAll block and then run a set of tests, which may depend or not on previous tests (they are always run in the specified order by specification) which allows some integration scenarios to be tested more quickly than it would be if the tests had to be written in an independent way and also gives developers more flexibility on how they write code.

For this to work, OOJSpec has to run each set of tests, grouped in an specification file, in a separate iframe. OOJSpec currently uses sprockets to create such structure in a similar way adopted by other gems like Konacha and others. It would be awesome to be able to use Karma infra-structure to run a custom HTML runner created to be compatible with Karma API so that it reports the tests run correctly to the client console. It should be doable once we have the ability to specify how the HTML should be written. My plan is to integrate OOJSpec to webpack and test with Karma and stop using sprockets. Another advantage of running the tests in separate iframes is that you are able to test whether all required dependencies were correctly declared since only the dependencies for that test file are loaded in the isolated iframe.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's in the head? Metadata in HTML - MDN Web Docs
What's in the head? Metadata in HTML · What is the HTML head? · Adding a title · Metadata: the <meta> element ·...
Read more >
Include another HTML file in a HTML file - Stack Overflow
In my opinion the best solution uses jQuery: a.html : <html> <head> <script src="jquery.js"></script> <script> $(function(){ ...
Read more >
How To Add JavaScript to HTML | DigitalOcean
The <script> tag is pointing to the script.js file in the js/ directory of our web project. Let's consider this line in the...
Read more >
How to add a custom right-click menu to a webpage
Welcome to GeeksforGeeks. ... custom context menu here. ... If we right-click on this page, the default menu will pop up. JavaScript code...
Read more >
HTML Styles CSS - W3Schools
Internal - by using a <style> element in the <head> section; External - by using a <link> element to link to an external...
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