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

Ignore Horizon routes #3

Closed
wants to merge 3 commits into from

Conversation

adampatterson
Copy link

I noticed that the routes for Telescope were ignored and thought that it would also be good to exclude Horizons routes.

@zepfietje
Copy link
Collaborator

Thanks, @adampatterson, I agree it would be good to also ignore Horizon routes by default.
However, as the list of routes to be ignored gets longer, maybe we should think of a configurable solution? Any ideas?

@adampatterson
Copy link
Author

@zepfietje I like that, you may not want to track dashboard or admin views.

I'll update my PR over the next few days to pull from an array in the pirsch config file.

@zepfietje
Copy link
Collaborator

Not tracking dashboard or admin views is quite easy already by just removing (or not adding) the middleware from those routes. So this feature would be most useful for third-party package routes. But yes, might as well use it to simplify ignoring a group of routes.

Let me know when you're ready by marking this PR as ready for review. 😊

@zepfietje zepfietje marked this pull request as draft August 29, 2023 06:48
@zepfietje zepfietje removed their request for review August 29, 2023 06:48
@zepfietje
Copy link
Collaborator

Is this ready for review, @adampatterson? 🙂

@adampatterson
Copy link
Author

@zepfietje Iet me double check this weekend.

I had Pirsch running on a server that Oracle decided to delete on me 🙃

@zepfietje
Copy link
Collaborator

No rush, @adampatterson! Just wondered what the status of this PR was :)

@zepfietje
Copy link
Collaborator

Replaced by #9.

@adampatterson
Copy link
Author

Replaced by #9.

Sorry, I no longer had a way of testing with Pirsh.

@zepfietje
Copy link
Collaborator

No worries, @adampatterson.

@adampatterson
Copy link
Author

@zepfietje what's the best method for testing Pircsh since the trial is limited to 30 days?

@zepfietje
Copy link
Collaborator

I'm sure @Kugelschieber can help you test it for a little longer if needed. 🙂

@Kugelschieber
Copy link
Member

@adampatterson I can extend your trial. Can you send an email to [email protected] with your account email address?

@adampatterson
Copy link
Author

@zepfietje I went ahead and updated my branch with the latest changes and tested in Pirsh and everything seems to be working as expected but I did notice something odd with the unit tests.

I have never used PEST before so duplicated a few previous tests and set the configs as if I were going to exclude a custom route or header.

https://github.com/adampatterson/laravel-pirsch/blob/middleware/tests/TrackPageviewTest.php#L50

And they passed, so naturally I tried to break the test and it kept passing.

I then went back to a previous test and modified the excluded_routes values and the test still passed.

I then modified the test it's self and it kept passing.

return [
    'excluded_routes' => [
        //
    ],
,
it('skips Telescope', function () {
    Pirsch::spy();

    Route::middleware(TrackPageview::class)
        ->get('thisshouldcall/test', fn() => 'Hello World');

    $this->get('/thisshouldcall/test');

    Pirsch::shouldNotHaveBeenCalled();
});

I would expect this to fail since the route is not excluded.

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.

3 participants