Title: [router/testing] `No base href set` errors in tests appear with router when using Debug Mode · Issue #19116 · angular/angular-cli · GitHub
Open Graph Title: [router/testing] `No base href set` errors in tests appear with router when using Debug Mode · Issue #19116 · angular/angular-cli
X Title: [router/testing] `No base href set` errors in tests appear with router when using Debug Mode · Issue #19116 · angular/angular-cli
Description: 🐞 Bug report new build serve test e2e generate add update lint xi18n run config help version doc Is this a regression? No. Seems to me that it's a pretty old issue. Description In short, when testing an app with routing, tests will run f...
Open Graph Description: 🐞 Bug report new build serve test e2e generate add update lint xi18n run config help version doc Is this a regression? No. Seems to me that it's a pretty old issue. Description In short, when testi...
X Description: 🐞 Bug report new build serve test e2e generate add update lint xi18n run config help version doc Is this a regression? No. Seems to me that it's a pretty old issue. Description In short, when t...
Opengraph URL: https://github.com/angular/angular-cli/issues/19116
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[router/testing] `No base href set` errors in tests appear with router when using Debug Mode","articleBody":"# 🐞 Bug report\r\n\r\n- [ ] new\r\n- [ ] build\r\n- [ ] serve\r\n- [x] test\r\n- [ ] e2e\r\n- [ ] generate\r\n- [ ] add\r\n- [ ] update\r\n- [ ] lint\r\n- [ ] xi18n\r\n- [ ] run\r\n- [ ] config\r\n- [ ] help\r\n- [ ] version\r\n- [ ] doc\r\n\r\n\r\n### Is this a regression?\r\n\r\nNo. Seems to me that it's a pretty old issue.\r\n\r\n\r\n### Description\r\n\r\nIn short, when testing an app with routing, tests will run fine unless you toggle Karma's debug mode. There all components with routing will throw the aforementioned \"No base href set\" error.\r\n\r\n\r\n## 🔬 Minimal Reproduction\r\nI've made a demo repo for it [here](https://github.com/IxquitilisSaid/karma-debug-routing-error)\r\n\r\n```\r\nnpm i\r\nng test\r\n```\r\n\r\nInitially, all the tests will be green and succeed but if you click the `Debug` button above, you'll see the error being thrown\r\n\r\n## 🔥 Exception or Error\r\n\u003cpre>\u003ccode>\r\nError: No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.\r\n at new PathLocationStrategy (http://localhost:9876/_karma_webpack_/node_modules/@angular/common/__ivy_ngcc__/fesm2015/common.js:378:1)\r\n at Object.provideLocationStrategy [as useFactory] (http://localhost:9876/_karma_webpack_/node_modules/@angular/router/__ivy_ngcc__/fesm2015/router.js:5520:1)\r\n at Object.factory (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:11338:1)\r\n at R3Injector.hydrate (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:11249:1)\r\n at R3Injector.get (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:11071:1)\r\n at injectInjectorOnly (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:801:1)\r\n at Module.ɵɵinject (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:805:1)\r\n at Object.Location_Factory [as factory] (http://localhost:9876/_karma_webpack_/node_modules/@angular/common/__ivy_ngcc__/fesm2015/common.js:695:90)\r\n at R3Injector.hydrate (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:11249:1)\r\n at R3Injector.get (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:11071:1)\r\n\u003c/code>\u003c/pre>\r\n\r\n\r\n## 🌍 Your Environment\r\n\u003cpre>\u003ccode>\r\n _ _ ____ _ ___\r\n / \\ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|\r\n / △ \\ | '_ \\ / _` | | | | |/ _` | '__| | | | | | |\r\n / ___ \\| | | | (_| | |_| | | (_| | | | |___| |___ | |\r\n /_/ \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_| \\____|_____|___|\r\n |___/\r\n\r\n\r\nAngular CLI: 10.0.8\r\nNode: 10.16.0\r\nOS: darwin x64\r\n\r\nAngular: 10.0.14\r\n... animations, common, compiler, compiler-cli, core, forms\r\n... platform-browser, platform-browser-dynamic, router\r\nIvy Workspace: Yes\r\n\r\nPackage Version\r\n-----------------------------------------------------------\r\n@angular-devkit/architect 0.1000.8\r\n@angular-devkit/build-angular 0.1000.8\r\n@angular-devkit/build-optimizer 0.1000.8\r\n@angular-devkit/build-webpack 0.1000.8\r\n@angular-devkit/core 10.0.8\r\n@angular-devkit/schematics 10.0.8\r\n@angular/cli 10.0.8\r\n@ngtools/webpack 10.0.8\r\n@schematics/angular 10.0.8\r\n@schematics/update 0.1000.8\r\nrxjs 6.5.5\r\ntypescript 3.9.7\r\nwebpack 4.43.0\r\n\u003c/code>\u003c/pre>\r\n\r\n","author":{"url":"https://github.com/IxquitilisSaid","@type":"Person","name":"IxquitilisSaid"},"datePublished":"2020-10-19T09:02:04Z","url":"https://github.com/angular/angular-cli/issues/19116"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:05dc010a-d5ff-41a9-90cb-8c38cd909753 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AE12:2A1EC8:11D8BF9:166AA91:6B024A60 |
| html-safe-nonce | 1a27b36423124e33afb2214516e84c9153fe605cae468f166583f32fd907d551 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTEyOjJBMUVDODoxMUQ4QkY5OjE2NkFBOTE6NkIwMjRBNjAiLCJ2aXNpdG9yX2lkIjoiNDk4MzQ3NTM1MDE5MDMxMjAzMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9593349719706bb93fcce3035822d8f1031d1dac9f619a466c0286bbaf081f2a |
| hovercard-subject-tag | issue:724420533 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/19116/issue_layout |
| twitter:image | https://opengraph.githubassets.com/56cbe3aa6e5a072c11d0c09dad1ffbffed2c42a7125107058b63bfcf0ad82e97/angular/angular-cli/issues/19116 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/56cbe3aa6e5a072c11d0c09dad1ffbffed2c42a7125107058b63bfcf0ad82e97/angular/angular-cli/issues/19116 |
| og:image:alt | 🐞 Bug report new build serve test e2e generate add update lint xi18n run config help version doc Is this a regression? No. Seems to me that it's a pretty old issue. Description In short, when testi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | IxquitilisSaid |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width