Angular 6 ng test error Cannot match any Routes

Asked

Viewed 574 times

0

Error while rotating ng test.

 {
    "message": "An error was thrown in afterAll\nUncaught Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'home'\nError: Cannot match any routes. URL Segment: 'home'\n    at ApplyRedirects.noMatchError (./node_modules/@angular/router/fesm5/router.js?:1455:16)\n    at CatchSubscriber.eval [as selector] (./node_modules/@angular/router/fesm5/router.js?:1436:29)\n    at CatchSubscriber.error (./node_modules/rxjs/_esm5/internal/operators/catchError.js?:40:31)\n    at MapSubscriber.Subscriber._error (./node_modules/rxjs/_esm5/internal/Subscriber.js?:89:26)\n    at MapSubscriber.Subscriber.error (./node_modules/rxjs/_esm5/internal/Subscriber.js?:69:18)\n    at MapSubscriber.Subscriber._error (./node_modules/rxjs/_esm5/internal/Subscriber.js?:89:26)\n    at MapSubscriber.Subscriber.error (./node_modules/rxjs/_esm5/internal/Subscriber.js?:69:18)\n    at MapSubscriber.Subscriber._error (./node_modules/rxjs/_esm5/internal/Subscriber.js?:89:26)\n    at MapSubscriber.Subscriber.error (./node_modules/rxjs/_esm5/internal/Subscriber.js?:69:18)\n    at TapSubscriber._error (./node_modules/rxjs/_esm5/internal/operators/tap.js?:67:26) thrown",
    "str": "An error was thrown in afterAll\nUncaught Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'home'\nError: Cannot match any routes. URL Segment: 'home'\n    at ApplyRedirects.noMatchError (./node_modules/@angular/router/fesm5/router.js?:1455:16)\n    at CatchSubscriber.eval [as selector] (./node_modules/@angular/router/fesm5/router.js?:1436:29)\n    at CatchSubscriber.error (./node_modules/rxjs/_esm5/internal/operators/catchError.js?:40:31)\n    at MapSubscriber.Subscriber._error (./node_modules/rxjs/_esm5/internal/Subscriber.js?:89:26)\n    at MapSubscriber.Subscriber.error (./node_modules/rxjs/_esm5/internal/Subscriber.js?:69:18)\n    at MapSubscriber.Subscriber._error (./node_modules/rxjs/_esm5/internal/Subscriber.js?:89:26)\n    at MapSubscriber.Subscriber.error (./node_modules/rxjs/_esm5/internal/Subscriber.js?:69:18)\n    at MapSubscriber.Subscriber._error (./node_modules/rxjs/_esm5/internal/Subscriber.js?:89:26)\n    at MapSubscriber.Subscriber.error (./node_modules/rxjs/_esm5/internal/Subscriber.js?:69:18)\n    at TapSubscriber._error (./node_modules/rxjs/_esm5/internal/operators/tap.js?:67:26) thrown"
  }

Note: Error is intermittent. When there is no error the tests pass all.

$ node_modules\.bin\ng -v

Angular CLI: 6.2.9
Node: 10.13.0
OS: win32 x64
Angular: 6.1.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, route
  • Put the code snippet that fails the test and the test, only with this message there is no way to know what is happening.

  • I am trying to understand what is wrong. As I said it is intermittent, and when it does not give this error message, it is giving SUCCESS in the tests.

  • Have some error in calling routes in your html, post the html that is accusing this error

  • Which html is in error? I don’t know if you read the previous comment, but it’s intermittent and when it doesn’t, it ends the tests with SUCCESS. I posted the doubt precisely because I don’t understand why to give this message. It’s not a readable error, and the messages don’t help. If you know something thank you. If it’s a matter of version, then patience, but wanted to better understand about it.

  • tries to run something like npm run test home.Component ai vc isolates the components and see which one has a problem

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.