-
Notifications
You must be signed in to change notification settings - Fork 257
Expand file tree
/
Copy pathhono.feature
More file actions
112 lines (104 loc) · 5.53 KB
/
hono.feature
File metadata and controls
112 lines (104 loc) · 5.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
@skip_before_node_18
Feature: @bugsnag/plugin-hono
Background:
Given I store the api key in the environment variable "BUGSNAG_API_KEY"
And I store the notify endpoint in the environment variable "BUGSNAG_NOTIFY_ENDPOINT"
And I store the sessions endpoint in the environment variable "BUGSNAG_SESSIONS_ENDPOINT"
And I start the service "hono"
And I wait for the host "hono" to open port "80"
Scenario: A handled error
Then I open the URL "http://hono/handled" tolerating any error
Then I wait to receive an error
Then the error is valid for the error reporting API version "4" for the "Bugsnag Node" notifier
And the event "unhandled" is false
And the event "severity" equals "warning"
And the exception "errorClass" equals "Error"
And the exception "message" equals "handled"
And the exception "type" equals "nodejs"
And the "file" of stack frame 0 equals "scenarios/app.js"
And the event "request.url" equals "http://hono/handled"
And the event "request.httpMethod" equals "GET"
Scenario: a synchronous thrown error in a route
Then I open the URL "http://hono/sync?a=1&b=2c" tolerating any error
And I wait to receive an error
Then the error is valid for the error reporting API version "4" for the "Bugsnag Node" notifier
And the event "unhandled" is true
And the event "severity" equals "error"
And the event "severityReason.type" equals "unhandledErrorMiddleware"
And the event "severityReason.attributes.framework" equals "Hono"
And the exception "errorClass" equals "Error"
And the exception "message" equals "sync"
And the exception "type" equals "nodejs"
And the "file" of stack frame 0 equals "scenarios/app.js"
And the event "request.url" equals "http://hono/sync?a=1&b=2c"
And the event "request.httpMethod" equals "GET"
And the event "metaData.error_handler.after" is null
And the event "metaData.request.path" equals "/sync"
And the event "metaData.request.query.a" equals "1"
And the event "metaData.request.query.b" equals "2c"
# This route will cause the app to crash
Scenario: an asynchronous thrown error in a route
Then I open the URL "http://hono/async" tolerating any error
And I wait to receive an error
Then the error is valid for the error reporting API version "4" for the "Bugsnag Node" notifier
And the event "unhandled" is true
And the event "severity" equals "error"
And the event "severityReason.type" equals "unhandledErrorMiddleware"
And the event "severityReason.attributes.framework" equals "Hono"
And the exception "errorClass" equals "Error"
And the exception "message" equals "async"
And the exception "type" equals "nodejs"
And the "file" of stack frame 0 equals "scenarios/app.js"
And the event "request.url" equals "http://hono/async"
And the event "request.httpMethod" equals "GET"
And the event "severityReason.attributes.framework" equals "Hono"
Scenario: a synchronous promise rejection in a route
Then I open the URL "http://hono/rejection-sync"
Then I wait to receive an error
Then the error is valid for the error reporting API version "4" for the "Bugsnag Node" notifier
And the event "unhandled" is true
And the event "severity" equals "error"
And the event "severityReason.type" equals "unhandledPromiseRejection"
And the exception "errorClass" equals "Error"
And the exception "message" equals "reject sync"
And the exception "type" equals "nodejs"
And the "file" of stack frame 0 equals "scenarios/app.js"
And the event "request.url" equals "http://hono/rejection-sync"
And the event "request.httpMethod" equals "GET"
Scenario: an asynchronous promise rejection in a route
Then I open the URL "http://hono/rejection-async"
Then I wait to receive an error
Then the error is valid for the error reporting API version "4" for the "Bugsnag Node" notifier
And the event "unhandled" is true
And the event "severity" equals "error"
And the event "severityReason.type" equals "unhandledPromiseRejection"
And the exception "errorClass" equals "Error"
And the exception "message" equals "reject async"
And the exception "type" equals "nodejs"
And the "file" of stack frame 0 equals "scenarios/app.js"
And the event "request.url" equals "http://hono/rejection-async"
And the event "request.httpMethod" equals "GET"
Scenario: throwing non-Error error
Then I open the URL "http://hono/throw-non-error"
Then I wait to receive an error
Then the error is valid for the error reporting API version "4" for the "Bugsnag Node" notifier
And the event "unhandled" is true
And the event "severity" equals "error"
And the event "severityReason.type" equals "unhandledErrorMiddleware"
And the exception "errorClass" equals "InvalidError"
And the exception "message" matches "hono middleware received a non-error\."
And the exception "type" equals "nodejs"
And the event "request.url" equals "http://hono/throw-non-error"
And the event "request.httpMethod" equals "GET"
Scenario: error handler awaits next()
When I POST the data "{\"a\":1,\"b\":2}" to the URL "http://hono/post-body" with the content type "application/json"
Then I wait to receive an error
Then the error is valid for the error reporting API version "4" for the "Bugsnag Node" notifier
And the event "unhandled" is false
And the event "severity" equals "warning"
And the exception "errorClass" equals "Error"
And the exception "message" matches "error in post body route"
And the exception "type" equals "nodejs"
And the "file" of stack frame 0 equals "scenarios/app.js"
And the event "request.url" equals "http://hono/post-body"
And the event "request.httpMethod" equals "POST"