{"action":"opened","issue":{"url":"https://api.github.com/repos/karma-runner/karma/issues/2525","repository_url":"https://api.github.com/repos/karma-runner/karma","labels_url":"https://api.github.com/repos/karma-runner/karma/issues/2525/labels{/name}","comments_url":"https://api.github.com/repos/karma-runner/karma/issues/2525/comments","events_url":"https://api.github.com/repos/karma-runner/karma/issues/2525/events","html_url":"https://github.com/karma-runner/karma/issues/2525","id":198652429,"number":2525,"title":"Inconsistent trailing slash for config.basePath","user":{"login":"Ricq","id":870390,"avatar_url":"https://avatars.githubusercontent.com/u/870390?v=3","gravatar_id":"","url":"https://api.github.com/users/Ricq","html_url":"https://github.com/Ricq","followers_url":"https://api.github.com/users/Ricq/followers","following_url":"https://api.github.com/users/Ricq/following{/other_user}","gists_url":"https://api.github.com/users/Ricq/gists{/gist_id}","starred_url":"https://api.github.com/users/Ricq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ricq/subscriptions","organizations_url":"https://api.github.com/users/Ricq/orgs","repos_url":"https://api.github.com/users/Ricq/repos","events_url":"https://api.github.com/users/Ricq/events{/privacy}","received_events_url":"https://api.github.com/users/Ricq/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-04T08:21:14Z","updated_at":"2017-01-04T08:21:14Z","closed_at":null,"body":"I'm trying to build a Karma configuration that runs across different developer and build machines.\r\nThe issue I'm running into is that it seems that there is no consistent way to make the base path either always end with a trailing slash or always have no trailing slash. What I've found is that the base path is built using Node's `path.resolve(...)` method (in config.js). Node's documentation mentions that \r\n`path.resolve()` will have directories never end with a slash, unless the path indicates the root directory. \r\n\r\nIn my environment some developers map their version control snapshot to a drive letter on Windows, making `path.resolve()` yield something like: `X:/` (trailing slash), where for other locations it maps to something like `C:/snapshot` (no trailing slash) or `/var/jenkins/project/workspace` (no trailing slash).\r\nNo matter what I configure for `config.basePath` (with and without slashes), the path will always be normalized using the above logic. Thus, when I attempt to build my imports on the browser side, I sometimes have to map to `http://localhost:9876/base/mypath`, and sometimes to `http://localhost:9876/basemypath` (no intemediate slash). There seems to be no way to determine on the browser side whether I need to include the slash on the machine under test, and if I choose one mapping it will fail for the other case.\r\n\r\nMy gut feel is that Karma should either\r\n\r\n- provide a consistent basePath slash behavior (i.e. always end with or without a slash for root dirs and non-root dirs), or\r\n- that Karma should provide a way in the browser environment to know whether base needs an extra slash or not, or\r\n- that the Karma http server shouldn't care, and just use path.join in source_files.js.\r\n\r\n### Expected behaviour\r\n * basePath consistently ends with either a trailing slash, or without, or correctly joins paths regardless of the slash, allowing the reuse of a Karma configuration across different developer machines with different checkout drives.\r\n\r\n### Actual behaviour\r\n * On Windows, the basePath resolves to a path without a slash, except for the root folder of a drive. It is then not possible to create a dependency path in the client that consistently works across both variations.\r\n\r\n### Environment Details\r\n * Windows 10\r\n- Karma version (output of `karma --version`): 0.13.22\r\n- Relevant part of your `karma.config.js` file: `config.set({basePath: '../../..',`\r\n\r\n### Steps to reproduce the behaviour\r\n1. Setup a Karma run on Windows, hosted in a version control snapshot in some subdirectory (e.g. c:\\dev)\r\n2. Run the exact same code in a root directory checkout (e.g.: x:\\)"}}
{"actor":{"display_login":"Ricq"}}