Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/atoomic/test-mojo-role-debug-json
extension of Test::Mojo::Role::Debug
https://github.com/atoomic/test-mojo-role-debug-json
Last synced: about 2 months ago
JSON representation
extension of Test::Mojo::Role::Debug
- Host: GitHub
- URL: https://github.com/atoomic/test-mojo-role-debug-json
- Owner: atoomic
- Created: 2018-02-07T21:15:47.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-10-13T16:03:07.000Z (about 4 years ago)
- Last Synced: 2024-10-13T11:34:33.867Z (3 months ago)
- Language: Perl
- Size: 20.5 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.mkdn
- Changelog: Changes
Awesome Lists containing this project
README
[![Actions Status](https://github.com/atoomic/Test-Mojo-Role-Debug-JSON/workflows/linux/badge.svg)](https://github.com/atoomic/Test-Mojo-Role-Debug-JSON/actions)
[![Actions Status](https://github.com/atoomic/Test-Mojo-Role-Debug-JSON/workflows/macos/badge.svg)](https://github.com/atoomic/Test-Mojo-Role-Debug-JSON/actions)
[![Actions Status](https://github.com/atoomic/Test-Mojo-Role-Debug-JSON/workflows/windows/badge.svg)](https://github.com/atoomic/Test-Mojo-Role-Debug-JSON/actions)# NAME
Test::Mojo::Role::Debug::JSON - a JSON extension to Test::Mojo::Role::Debug
# VERSION
version 0.006
# SYNOPSIS
# DESCRIPTION
When you chain up a bunch of tests and they fail, you really want an easy
way to dump up your markup at a specific point in that chain and see
what's what. This module comes to the rescue.# NAME
Test::Mojo::Role::Debug::JSON - Test::Mojo role to make debugging test failures easier
This is an extension of [Test::Mojo::Role::Debug](https://metacpan.org/pod/Test%3A%3AMojo%3A%3ARole%3A%3ADebug).
Its usage and syntax are very similar.
Test::Mojo::Role::Debug provides the subs 'd' and 'da',
whereas Test::Mojo::Role::Debug::JSON provides the additional 'djson' and 'djsona'```perl
use Test::More;use Test::Mojo::WithRoles 'Debug::JSON';
my $t = Test::Mojo::WithRoles->new('MyApp');
$t->get_ok('/')->status_is(200)
->d # Does nothing, since test succeeded - on failure dump content
->djson # Does nothing, since test succeeded - on failure dump content as json
->json_like( { status => 'ok' } )
->da # Always dump reply content
->djsona # Always dump the reply content as json
;done_testing;
```# METHODS
You have all the methods provided by [Test::Mojo](https://metacpan.org/pod/Test%3A%3AMojo), [Test::Mojo::Role::Debug](https://metacpan.org/pod/Test%3A%3AMojo%3A%3ARole%3A%3ADebug), plus these:
## `djson`
```
$t->djson; # print the answer as json
$t->djson('/status'); # print specific node as json
```**Returns** its invocant.
On failure of previous tests (see ["success" in Mojo::DOM](https://metacpan.org/pod/Mojo%3A%3ADOM#success)),
dumps the content output as json. Optionally, takes a JSON pointer to aid subset
larger responses.## `djsona`
```
$t->djsona;
$t->djsona('/status');
```Same as ["djson"](#djson), except it always dumps, regardless of whether the previous
test failed or not.# SEE ALSO
[Test::Mojo::Role::Debug::JSON](https://metacpan.org/pod/Test%3A%3AMojo%3A%3ARole%3A%3ADebug%3A%3AJSON), [Test::Mojo](https://metacpan.org/pod/Test%3A%3AMojo) (["or" in Test::Mojo](https://metacpan.org/pod/Test%3A%3AMojo#or) in particular), [Mojo::DOM](https://metacpan.org/pod/Mojo%3A%3ADOM)
# REPOSITORY
Fork this module on GitHub:
[https://github.com/atoomic/Test-Mojo-Role-Debug-JSON](https://github.com/atoomic/Test-Mojo-Role-Debug-JSON)# BUGS
To report bugs or request features, please use
[https://github.com/atoomic/Test-Mojo-Role-Debug-JSON/issues](https://github.com/atoomic/Test-Mojo-Role-Debug-JSON/issues)Contrinuous integration coverage
[https://travis-ci.org/atoomic/Test-Mojo-Role-Debug-JSON](https://travis-ci.org/atoomic/Test-Mojo-Role-Debug-JSON)# AUTHOR
# CONTRIBUTORS
# LICENSE
You can use and distribute this module under the same terms as Perl itself.
See the `LICENSE` file included in this distribution for complete
details.# AUTHOR
Nicolas R
# COPYRIGHT AND LICENSE
This software is copyright (c) 2018 by Nicolas R.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.