Skip to content

Commit

Permalink
tests: run express tests on appropriate Node.js versions
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Jul 12, 2019
1 parent 7980b82 commit 617aa06
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/3.x/async_helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var path = require('path')
var request = require('supertest')
var utils = require('../support/utils')

var FIXTURES_DIR = path.join(__dirname, '..', 'fixtures')

Expand All @@ -11,6 +12,11 @@ var app = null
suite('express 3.x async helpers')

before(function () {
if (utils.nodeVersionCompare(10.0) >= 0) {
this.skip()
return
}

var express = require('express')
var hbs = require('../../').create()

Expand Down
5 changes: 5 additions & 0 deletions test/3.x/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ var utils = require('../support/utils')
suite('express 3.x')

before(function (done) {
if (utils.nodeVersionCompare(10.0) >= 0) {
this.skip()
return done()
}

var env = utils.childEnvironment()

this.timeout(30000)
Expand Down
6 changes: 6 additions & 0 deletions test/3.x/no_layout_app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var path = require('path')
var request = require('supertest')
var utils = require('../support/utils')

var FIXTURES_DIR = path.join(__dirname, '..', 'fixtures')

Expand All @@ -12,6 +13,11 @@ var app = null
suite('express 3.x no layout')

before(function () {
if (utils.nodeVersionCompare(10.0) >= 0) {
this.skip()
return
}

var express = require('express')
var hbs = require('../../')

Expand Down
6 changes: 6 additions & 0 deletions test/3.x/view_engine.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var path = require('path')
var request = require('supertest')
var utils = require('../support/utils')

var FIXTURES_DIR = path.join(__dirname, '..', 'fixtures')

Expand All @@ -11,6 +12,11 @@ var app = null
suite('express 3.x view engine')

before(function () {
if (utils.nodeVersionCompare(10.0) >= 0) {
this.skip()
return
}

var express = require('express')
var hbs = require('../../')

Expand Down
6 changes: 6 additions & 0 deletions test/4.x/async_helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var path = require('path')
var request = require('supertest')
var utils = require('../support/utils')

var FIXTURES_DIR = path.join(__dirname, '..', 'fixtures')

Expand All @@ -11,6 +12,11 @@ var app = null
suite('express 4.x async helpers')

before(function () {
if (utils.nodeVersionCompare(0.10) <= 0) {
this.skip()
return
}

var express = require('express')
var hbs = require('../../').create()

Expand Down
5 changes: 5 additions & 0 deletions test/4.x/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ var utils = require('../support/utils')
suite('express 4.x')

before(function (done) {
if (utils.nodeVersionCompare(0.10) <= 0) {
this.skip()
return done()
}

var env = utils.childEnvironment()

this.timeout(30000)
Expand Down
6 changes: 6 additions & 0 deletions test/4.x/no_layout_app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var path = require('path')
var request = require('supertest')
var utils = require('../support/utils')

var FIXTURES_DIR = path.join(__dirname, '..', 'fixtures')

Expand All @@ -13,6 +14,11 @@ var app = null
suite('express 4.x no layout')

before(function () {
if (utils.nodeVersionCompare(0.10) <= 0) {
this.skip()
return
}

var express = require('express')
var hbs = require('../../')

Expand Down
6 changes: 6 additions & 0 deletions test/4.x/view_engine.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var path = require('path')
var request = require('supertest')
var utils = require('../support/utils')

var FIXTURES_DIR = path.join(__dirname, '..', 'fixtures')

Expand All @@ -11,6 +12,11 @@ var app = null
suite('express 4.x view engine')

before(function () {
if (utils.nodeVersionCompare(0.10) <= 0) {
this.skip()
return
}

var express = require('express')
var hbs = require('../../')

Expand Down
5 changes: 5 additions & 0 deletions test/support/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'

module.exports.childEnvironment = childEnvironment
module.exports.nodeVersionCompare = nodeVersionCompare

function childEnvironment () {
var env = Object.create(null)
Expand All @@ -14,3 +15,7 @@ function childEnvironment () {

return env
}

function nodeVersionCompare (version) {
return parseFloat(process.version.substr(1).split('.').slice(0, 2).join('.')) - version
}

0 comments on commit 617aa06

Please sign in to comment.