Skip to content

Commit

Permalink
chore(test): move test scripts to node files
Browse files Browse the repository at this point in the history
nodejs inbalanced support for proxies requires a conditional before running the tests
  • Loading branch information
thetutlage committed Oct 31, 2016
1 parent 6dd0f92 commit 08e1fef
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
12 changes: 12 additions & 0 deletions bin/coverage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict'

const semver = require('semver')
const shell = require('shelljs')
const nodeJsVersion = process.version
let proxiesFlag = ''

if (semver.lt(nodeJsVersion, '6.0.0')) {
proxiesFlag = '--harmony_proxies'
}

shell.exec(`DB=${process.env.DB} node ${proxiesFlag} ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha test/unit test/acceptance`)
12 changes: 12 additions & 0 deletions bin/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict'

const semver = require('semver')
const shell = require('shelljs')
const nodeJsVersion = process.version
let proxiesFlag = ''

if (semver.lt(nodeJsVersion, '6.0.0')) {
proxiesFlag = '--harmony_proxies'
}

shell.exec(`DB=${process.env.DB} node ${proxiesFlag} ./node_modules/.bin/istanbul cover _mocha --colors --report lcovonly -- -R spec test/unit test/acceptance && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage`)
16 changes: 13 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,20 @@
"scripts": {
"lint": "standard",
"test:all": "DB=sqlite3 npm run test && DB=mysql npm run test && DB=pg npm run test",
"coverage": "npm run lint && node --harmony_proxies ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha test/unit test/acceptance",
"test": "npm run lint && node --harmony_proxies ./node_modules/.bin/istanbul cover _mocha --report lcovonly -- -R spec test/unit test/acceptance && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage"
"coverage": "npm run lint && node ./bin/coverage",
"test": "npm run lint && node ./bin/test"
},
"standard": {
"global": ["use", "describe", "it", "after", "before", "context", "make", "beforeEach"]
"global": [
"use",
"describe",
"it",
"after",
"before",
"context",
"make",
"beforeEach"
]
},
"author": "adonisjs",
"license": "MIT",
Expand All @@ -32,6 +41,7 @@
"mysql": "^2.10.2",
"pg": "^4.5.1",
"semantic-release": "^4.3.5",
"semver": "^5.3.0",
"shelljs": "^0.7.4",
"sqlite3": "^3.1.1",
"standard": "^8.0.0"
Expand Down

0 comments on commit 08e1fef

Please sign in to comment.