Skip to content
This repository was archived by the owner on Apr 3, 2019. It is now read-only.

Commit 499c9fa

Browse files
committed
fix(tests): separate remote and local test runs
1 parent 0f6ff5c commit 499c9fa

File tree

5 files changed

+27
-30
lines changed

5 files changed

+27
-30
lines changed

npm-shrinkwrap.json

Lines changed: 6 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"nock": "8.0.0",
112112
"npmshrink": "1.0.1",
113113
"nyc": "13.0.0",
114-
"proxyquire": "1.8.0",
114+
"proxyquire": "2.0.0",
115115
"simplesmtp": "0.3.35",
116116
"sinon": "1.17.5",
117117
"sjcl": "1.0.6",

scripts/mocha-coverage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const MOCHA_BIN = path.join(path.dirname(__dirname), 'node_modules', '.bin', 'mo
1313
const NYC_BIN = path.join(path.dirname(__dirname), 'node_modules', '.bin', 'nyc')
1414

1515
let bin = NYC_BIN
16-
let argv = ['--cache', MOCHA_BIN]
16+
let argv = ['--cache', '--no-clean', MOCHA_BIN]
1717

1818
if (process.env.NO_COVERAGE) {
1919
bin = MOCHA_BIN

scripts/test-local.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,20 @@ if [ -z "$CORS_ORIGIN" ]; then export CORS_ORIGIN="http://foo,http://bar"; fi;
77

88
set -u
99

10-
GLOB=$*
11-
if [ -z "$GLOB" ]; then
12-
GLOB="test/local test/remote"
13-
fi
14-
1510
DEFAULT_ARGS="-R dot --recursive --timeout 5000 --exit"
1611

1712
./scripts/gen_keys.js
1813
./scripts/gen_vapid_keys.js
19-
./scripts/mocha-coverage.js $DEFAULT_ARGS $GLOB
14+
15+
GLOB=$*
16+
if [ -z "$GLOB" ]; then
17+
echo "Local tests"
18+
./scripts/mocha-coverage.js $DEFAULT_ARGS test/local
19+
20+
echo "Remote tests"
21+
./scripts/mocha-coverage.js $DEFAULT_ARGS test/remote
22+
else
23+
./scripts/mocha-coverage.js $DEFAULT_ARGS $GLOB
24+
fi
25+
2026
grunt eslint copyright

test/remote/db_tests.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -683,15 +683,13 @@ describe('remote db', function() {
683683
.then(function(passwordForgotToken) {
684684
return db.forgotPasswordVerified(passwordForgotToken)
685685
.then(accountResetToken => {
686-
assert.ok(accountResetToken.createdAt > passwordForgotToken.createdAt, 'account reset token should be newer than password forgot token')
686+
assert.ok(accountResetToken.createdAt >= passwordForgotToken.createdAt, 'account reset token should be equal or newer than password forgot token')
687687
return accountResetToken
688688
})
689689
})
690690
.then(function(accountResetToken) {
691691
assert.deepEqual(accountResetToken.uid, account.uid, 'account reset token uid should be the same as the account.uid')
692692
tokenId = accountResetToken.id
693-
})
694-
.then(function() {
695693
return db.accountResetToken(tokenId)
696694
})
697695
.then(function(accountResetToken) {
@@ -702,15 +700,13 @@ describe('remote db', function() {
702700
.then(function(accountResetToken) {
703701
return db.deleteAccountResetToken(accountResetToken)
704702
})
705-
.then(function() {
703+
.then(function () {
706704
return db.accountResetToken(tokenId)
707-
})
708-
.then(function(accountResetToken) {
709-
assert(false, 'The above accountResetToken() call should fail, since the accountResetToken has been deleted')
710-
}, function(err) {
711-
assert.equal(err.errno, 110, 'accountResetToken() fails with the correct error code')
712-
var msg = 'Error: The authentication token could not be found'
713-
assert.equal(msg, '' + err, 'accountResetToken() fails with the correct message')
705+
.then(assert.fail, function (err) {
706+
assert.equal(err.errno, 110, 'accountResetToken() fails with the correct error code')
707+
var msg = 'Error: The authentication token could not be found'
708+
assert.equal(msg, '' + err, 'accountResetToken() fails with the correct message')
709+
})
714710
})
715711
}
716712
)

0 commit comments

Comments
 (0)