karma-runner / karma-runner/karma

Add suffix '.html' in PROXIES value

Open
#2,962 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

I have unit tests in Angular 4. There is 1 component, which has iframe. The sourse of this iframe might be different, but the first part of the path is the same for each iframe.

so, it might also be /htm/dialogs/SelectDialog1, /htm/dialogs/SelectDialog2 etc.

When I test it, it tries to load this file /htm/dialogs/SelectDialog So, that's why I added this configuration in karma.config.js

proxies: {
'/htm/dialogs/': '/base/mock-server/dialogs/'
}
The main problem here that it tries to load this page http://localhost:9876/base/mock-server/dialogs/SelectDialog

However, according to my folder structure, it has to be http://localhost:9876/base/mock-server/dialogs/SelectDialog/index.html

Actually, I can change structure of folders on my mock-server.

Could you please help me how to add '/index.html'. It should be something like this

proxies: {
'/htm/dialogs/': '/base/mock-server/dialogs/****/index.html'
}

Contributor guide

Open the contributing guide

Research direction

Review the proxy configuration entry shown in karma.config.js and trace how the iframe request is mapped. Verify the request for /htm/dialogs/SelectDialog against the mock-server layout; done means the proxy can resolve varying dialog paths to the corresponding index.html page.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.