Skip to content

Commit

Permalink
use Bugsnag instead of req.bugsnag in express fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Skinner committed Mar 7, 2023
1 parent 48cd972 commit 77a905b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/node/features/fixtures/express/scenarios/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ app.get('/oversized', function (req, res, next) {
big['entry'+i] = repeat('long repetitive string', 1000);
i++;
}
req.bugsnag.leaveBreadcrumb('big thing', big);
req.bugsnag.notify(new Error('oversized'));
Bugsnag.leaveBreadcrumb('big thing', big);
Bugsnag.notify(new Error('oversized'));
res.end('OK')
})

app.get('/handled', function (req, res, next) {
req.bugsnag.notify(new Error('handled'))
Bugsnag.notify(new Error('handled'))
res.end('OK')
})

Expand All @@ -144,11 +144,11 @@ app.post('/features/unhandled', bodyParser.urlencoded(), function (req, res, nex
// the request body is an object of feature flag name -> variant
const featureFlags = Object.keys(req.body).map(name => ({ name, variant: req.body[name] }))

req.bugsnag.addFeatureFlags(featureFlags)
req.bugsnag.clearFeatureFlag('from config 3')
Bugsnag.addFeatureFlags(featureFlags)
Bugsnag.clearFeatureFlag('from config 3')

if (req.body.hasOwnProperty('clearAllFeatureFlags')) {
req.bugsnag.clearFeatureFlags()
Bugsnag.clearFeatureFlags()
}

throw new Error('oh no')
Expand All @@ -158,14 +158,14 @@ app.post('/features/handled', bodyParser.urlencoded(), function (req, res, next)
// the request body is an object of feature flag name -> variant
const featureFlags = Object.keys(req.body).map(name => ({ name, variant: req.body[name] }))

req.bugsnag.addFeatureFlags(featureFlags)
req.bugsnag.clearFeatureFlag('from config 3')
Bugsnag.addFeatureFlags(featureFlags)
Bugsnag.clearFeatureFlag('from config 3')

if (req.body.hasOwnProperty('clearAllFeatureFlags')) {
req.bugsnag.clearFeatureFlags()
Bugsnag.clearFeatureFlags()
}

req.bugsnag.notify(new Error('oh no'))
Bugsnag.notify(new Error('oh no'))
res.end('OK')
})

Expand Down

0 comments on commit 77a905b

Please sign in to comment.