Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide URI to File-System Path Transalation #98

Closed
tntim96 opened this issue Sep 7, 2013 · 1 comment
Closed

Provide URI to File-System Path Transalation #98

tntim96 opened this issue Sep 7, 2013 · 1 comment
Assignees

Comments

@tntim96
Copy link
Owner

tntim96 commented Sep 7, 2013

Implement a generic solution for the scenario where, in proxy mode, a custom loader implementation results in the URI path not matching the file-system path (relative to the document-root). The translated path should, when appended to the document-root, match the file on the file-system. This translation is needed so that if the '--include-unloaded-js' option is present, JSCover will be able to recognize files on the file-system that have already been instrumented and therefore included in the report.

@tntim96
Copy link
Owner Author

tntim96 commented Sep 8, 2013

The solution for simple cases can be handled by providing two switches:

  1. --uri-to-file-matcher=REG specify a regular expression matcher with optional capture groups
  2. --uri-to-file-replace=REP specify a regular expression replacement with optional captured groups

An example to convert '/exclude/include/code.js' to '/include/code.js' would be: --uri-to-file-matcher=/exclude(.*) --uri-to-file-replace=$1

More difficult transformations can be handled by providing a JavaScript function in a file. This will be included if required by the community, but won't be solved as part of this log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant