Skip to content

Commit

Permalink
tests: exclude untestable lines in examples from coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed May 28, 2014
1 parent 1d54868 commit c18c2a8
Show file tree
Hide file tree
Showing 27 changed files with 91 additions and 39 deletions.
1 change: 1 addition & 0 deletions examples/auth/app.js
Expand Up @@ -118,6 +118,7 @@ app.post('/login', function(req, res){
});
});

/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
Expand Down
7 changes: 5 additions & 2 deletions examples/big-view/index.js
Expand Up @@ -20,5 +20,8 @@ app.get('/', function(req, res){
res.render('pets', { pets: pets });
});

app.listen(3000);
console.log('Express listening on port 3000');
/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
3 changes: 2 additions & 1 deletion examples/content-negotiation/index.js
Expand Up @@ -37,7 +37,8 @@ function format(path) {

app.get('/users', format('./users'));

/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('listening on port 3000');
console.log('Express started on port 3000');
}
5 changes: 3 additions & 2 deletions examples/cookie-sessions/index.js
Expand Up @@ -26,7 +26,8 @@ function count(req, res) {
res.send('viewed ' + n + ' times\n');
}

/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express server listening on port 3000');
}
console.log('Express started on port 3000');
}
5 changes: 3 additions & 2 deletions examples/cookies/app.js
Expand Up @@ -48,7 +48,8 @@ app.post('/', function(req, res){
res.redirect('back');
});

if (!module.parent){
/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
}
3 changes: 2 additions & 1 deletion examples/downloads/app.js
Expand Up @@ -38,7 +38,8 @@ app.use(function(err, req, res, next){
}
});

/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
}
3 changes: 2 additions & 1 deletion examples/ejs/index.js
Expand Up @@ -44,7 +44,8 @@ app.get('/', function(req, res){
});
});

/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express app started on port 3000');
console.log('Express started on port 3000');
}
5 changes: 3 additions & 2 deletions examples/error-pages/index.js
Expand Up @@ -106,7 +106,8 @@ app.get('/500', function(req, res, next){
next(new Error('keyboard cat!'));
});

/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
silent || console.log('Express started on port 3000');
}
console.log('Express started on port 3000');
}
3 changes: 2 additions & 1 deletion examples/error/index.js
Expand Up @@ -42,7 +42,8 @@ app.get('/next', function(req, res, next){
});
});

/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
}
7 changes: 5 additions & 2 deletions examples/expose-data-to-client/index.js
Expand Up @@ -56,5 +56,8 @@ app.get('/user', function(req, res){
res.render('page');
});

app.listen(3000);
console.log('app listening on port 3000');
/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
7 changes: 5 additions & 2 deletions examples/hello-world/index.js
Expand Up @@ -7,5 +7,8 @@ app.get('/', function(req, res){
res.send('Hello World');
});

app.listen(3000);
console.log('Express started on port 3000');
/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
7 changes: 5 additions & 2 deletions examples/jade/index.js
Expand Up @@ -41,5 +41,8 @@ app.get('/', function(req, res){
res.render('users', { users: users });
});

app.listen(3000);
console.log('Express app started on port 3000');
/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
1 change: 1 addition & 0 deletions examples/markdown/index.js
Expand Up @@ -39,6 +39,7 @@ app.get('/fail', function(req, res){
res.render('missing', { title: 'Markdown Example' });
})

/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
Expand Down
3 changes: 2 additions & 1 deletion examples/multipart/index.js
Expand Up @@ -30,7 +30,8 @@ app.post('/', function(req, res, next){
, req.body.title));
});

/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
}
3 changes: 2 additions & 1 deletion examples/mvc/index.js
Expand Up @@ -86,7 +86,8 @@ app.use(function(req, res, next){
res.status(404).render('404', { url: req.originalUrl });
});

/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('\n listening on port 3000\n');
console.log('Express started on port 3000');
}
7 changes: 5 additions & 2 deletions examples/online/index.js
Expand Up @@ -50,5 +50,8 @@ app.get('/', function(req, res, next){
});
});

app.listen(3000);
console.log('listening on port 3000');
/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
3 changes: 2 additions & 1 deletion examples/params/app.js
Expand Up @@ -64,7 +64,8 @@ app.get('/users/:from-:to', function(req, res, next){
res.send('users ' + names.slice(from, to).join(', '));
});

/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
}
3 changes: 2 additions & 1 deletion examples/resource/app.js
Expand Up @@ -85,7 +85,8 @@ app.get('/', function(req, res){
].join('\n'));
});

/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
}
6 changes: 5 additions & 1 deletion examples/route-map/index.js
Expand Up @@ -60,4 +60,8 @@ app.map({
}
});

app.listen(3000);
/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
7 changes: 5 additions & 2 deletions examples/route-middleware/index.js
Expand Up @@ -81,5 +81,8 @@ app.delete('/user/:id', loadUser, andRestrictTo('admin'), function(req, res){
res.send('Deleted user ' + req.user.name);
});

app.listen(3000);
console.log('Express app started on port 3000');
/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
7 changes: 5 additions & 2 deletions examples/route-separation/index.js
Expand Up @@ -36,5 +36,8 @@ app.put('/user/:id/edit', user.update);

app.get('/posts', post.list);

app.listen(3000);
console.log('Express app started on port 3000');
/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
7 changes: 5 additions & 2 deletions examples/search/index.js
Expand Up @@ -57,5 +57,8 @@ app.get('/client.js', function(req, res){
res.sendfile(__dirname + '/client.js');
});

app.listen(3000);
console.log('app listening on port 3000');
/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
7 changes: 5 additions & 2 deletions examples/session/index.js
Expand Up @@ -28,5 +28,8 @@ app.get('/', function(req, res){
res.send(body + '<p>viewed <strong>' + req.session.views + '</strong> times.</p>');
});

app.listen(3000);
console.log('Express app started on port 3000');
/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
7 changes: 5 additions & 2 deletions examples/vhost/index.js
Expand Up @@ -42,5 +42,8 @@ var app = express();
app.use(express.vhost('*.example.com', redirect)) // Serves all subdomains via Redirect app
app.use(express.vhost('example.com', main)); // Serves top level domain via Main server app

app.listen(3000);
console.log('Express app started on port 3000');
/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
1 change: 1 addition & 0 deletions examples/view-constructor/index.js
Expand Up @@ -41,6 +41,7 @@ app.get('/Readme.md', function(req, res){
res.render('Readme.md');
})

/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
Expand Down
7 changes: 5 additions & 2 deletions examples/view-locals/index.js
Expand Up @@ -142,5 +142,8 @@ app.all('/api/*', function(req, res, next){
*/

app.listen(3000);
console.log('Application listening on port 3000');
/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
}
5 changes: 3 additions & 2 deletions examples/web-service/index.js
Expand Up @@ -109,7 +109,8 @@ app.get('/api/user/:name/repos', function(req, res, next){
else next();
});

/* istanbul ignore next */
if (!module.parent) {
app.listen(3000);
console.log('Express server listening on port 3000');
}
console.log('Express started on port 3000');
}

0 comments on commit c18c2a8

Please sign in to comment.