-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
express: ensure that apps are at the top of stack when 'mount' is emi…
…tted
- Loading branch information
Michael Hayes
committed
Oct 9, 2014
1 parent
f319ccd
commit be324bf
Showing
3 changed files
with
141 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict' | ||
|
||
var test = require('tap').test | ||
var helper = require('../../lib/agent_helper') | ||
|
||
test('app should be at top of stack when mounted', function (t) { | ||
var agent = helper.instrumentMockedAgent() | ||
var express = require('express') | ||
|
||
this.tearDown(function cb_tearDown() { | ||
helper.unloadAgent(agent) | ||
}) | ||
|
||
t.plan(2) | ||
|
||
var main = express() | ||
var child = express() | ||
|
||
child.on('mount', function() { | ||
t.equal( | ||
main._router.stack.length, | ||
3, | ||
'3 middleware functions: query parser, Express, child' | ||
) | ||
}) | ||
|
||
main.use(child) | ||
|
||
t.equal( | ||
main._router.stack.length, | ||
4, | ||
'4 middleware functions: query parser, Express, child, error trapper' | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters