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

feat: catch resolve errors (fixes #41) #53

Merged
merged 2 commits into from
Mar 30, 2021

Conversation

cexbrayat
Copy link
Contributor

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • All tests are passing
  • New/updated tests are included

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

Adds a try/catch around the route resolution to simplify testing scenarios where the developers use router.push({name: 'hey'}) and do not want to declare the corresponding route, as they just want to check if push was called.

Fixes #41

@codecov-io
Copy link

Codecov Report

Merging #53 (6d59048) into v2 (c8e0b40) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##               v2      #53   +/-   ##
=======================================
  Coverage   99.01%   99.02%           
=======================================
  Files           5        5           
  Lines         102      103    +1     
  Branches       11       11           
=======================================
+ Hits          101      102    +1     
  Misses          1        1           
Impacted Files Coverage Δ
src/router.ts 98.33% <100.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c8e0b40...6d59048. Read the comment docs.

cexbrayat and others added 2 commits March 30, 2021 10:25
Adds a try/catch around the route resolution to simplify testing scenarios where the developers use `router.push({name: 'hey'})` and do not want to declare the corresponding route, as they just want to check if `push` was called.

Fixes posva#41
@posva posva force-pushed the fix/41-catch-resolve-error branch from 6d59048 to ee1efd6 Compare March 30, 2021 08:30
Copy link
Owner

@posva posva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! I added a new option noUndeclaredRoutes. Let me know what you think. If you have other ideas for names and such. I will add a few tests directly on v2

@posva posva merged commit f91dcdc into posva:v2 Mar 30, 2021
@cexbrayat
Copy link
Contributor Author

Sounds good. I like that the default is the more permissive way, thanks for merging this 👍

@cexbrayat cexbrayat deleted the fix/41-catch-resolve-error branch March 30, 2021 08:35
@posva
Copy link
Owner

posva commented Mar 30, 2021

Thanks for the proposal!

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

Successfully merging this pull request may close these issues.

router.push could be a simple mock functions by default?
3 participants