forked from pouchdb-community/pouchdb-authentication
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(nodejs): enhance test infrastructure to also test in nodejs
- Loading branch information
Showing
3 changed files
with
49 additions
and
4 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,35 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
var childProcess = require('child_process'); | ||
|
||
var binDir = 'node_modules/.bin/'; | ||
|
||
var client = process.env.CLIENT || 'phantom'; | ||
|
||
if (client === 'node') { | ||
npmRun('mocha', ['--ui', 'bdd', 'test/test.js']); | ||
} else if (client === 'phantom') { | ||
npm(['install', '--no-save', 'phantomjs-prebuilt']); | ||
npmRun('zuul', ['--phantom', '--ui', 'mocha-bdd', 'test/test.js']); | ||
} else if (client === 'local') { | ||
npmRun('zuul', ['--local', '9000', '--no-coverage', '--ui', 'mocha-bdd', 'test/test.js']); | ||
} | ||
|
||
function npm(args) { | ||
childProcess.spawnSync('npm', args, { | ||
env: process.env, | ||
stdio: 'inherit' | ||
}); | ||
} | ||
|
||
function npmRun(bin, args) { | ||
var testProcess = childProcess.spawn(binDir + bin, args, { | ||
env: process.env, | ||
stdio: 'inherit' | ||
}); | ||
|
||
testProcess.on('close', function (code) { | ||
process.exit(code); | ||
}); | ||
} |
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