diff --git a/fxa-auth-db-server/.eslintrc b/.eslintrc similarity index 100% rename from fxa-auth-db-server/.eslintrc rename to .eslintrc diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 45570c5..0000000 --- a/.jshintrc +++ /dev/null @@ -1,18 +0,0 @@ -{ - "asi": true, - "eqeqeq": true, - "esnext": true, - "forin": false, - "maxerr": 100, - "noarg": true, - "node": true, - "predef": [ - "exports", - "process", - "require" - ], - "shadow": false, - "strict": false, - "undef": true, - "unused": "vars" -} diff --git a/fxa-auth-db-server/AUTHORS b/AUTHORS similarity index 100% rename from fxa-auth-db-server/AUTHORS rename to AUTHORS diff --git a/CHANGELOG b/CHANGELOG-db.md similarity index 100% rename from CHANGELOG rename to CHANGELOG-db.md diff --git a/fxa-auth-db-server/CHANGELOG b/CHANGELOG-server.md similarity index 100% rename from fxa-auth-db-server/CHANGELOG rename to CHANGELOG-server.md diff --git a/fxa-auth-db-server/CONTRIBUTING.md b/CONTRIBUTING.md similarity index 94% rename from fxa-auth-db-server/CONTRIBUTING.md rename to CONTRIBUTING.md index eea2849..e5168b7 100644 --- a/fxa-auth-db-server/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,8 +17,8 @@ you saw the issue. Patches should be submitted as pull requests (PR). Before submitting a PR: -- Your code must run and pass all the automated tests before you submit your PR for review. "Work in progress" pull requests are allowed to be submitted, but should be clearly labeled as such and should not be merged until all tests pass and the code has been reviewed. - - Run `grunt jshint` to make sure your code passes linting. +- Your code must run and pass all the automated tests before you submit your PR for review. "Work in progress" pull requests are allowed to be submitted, but should be clearly labeled as such and should not be merged until all tests pass and the code has been reviewed. + - Run `grunt eslint` to make sure your code passes linting. - Run `npm test` to make sure all tests still pass. - Your patch should include new tests that cover your changes. It is your and your reviewer's responsibility to ensure your patch includes adequate tests. @@ -26,7 +26,7 @@ When submitting a PR: - You agree to license your code under the project's open source license ([MPL 2.0](/LICENSE)). - Base your branch off the current `master` (see below for an example workflow). - Add both your code and new tests if relevant. -- Run `grunt jshint` and `npm test` to make sure your code passes linting and tests. +- Run `grunt eslint` and `npm test` to make sure your code passes linting and tests. - Please do not include merge commits in pull requests; include only commits with the new relevant code. After your PR is merged: @@ -36,7 +36,7 @@ See the main [README.md](/README.md) for information on prerequisites, installin ## Code Review ## -This project is production Mozilla code and subject to our [engineering practices and quality standards](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Committing_Rules_and_Responsibilities). Every patch must be peer reviewed. This project is part of the [Firefox Accounts module](https://wiki.mozilla.org/Modules/Other#Firefox_Accounts), and your patch must be reviewed by one of the listed module owners or peers. +This project is production Mozilla code and subject to our [engineering practices and quality standards](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Committing_Rules_and_Responsibilities). Every patch must be peer reviewed. This project is part of the [Firefox Accounts module](https://wiki.mozilla.org/Modules/Other#Firefox_Accounts), and your patch must be reviewed by one of the listed module owners or peers. ## Example Workflow ## diff --git a/Gruntfile.js b/Gruntfile.js index abf2da5..5e0e12c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -7,5 +7,5 @@ module.exports = function (grunt) { grunt.loadTasks('grunttasks'); - grunt.registerTask('default', ['jshint', 'copyright']); + grunt.registerTask('default', ['eslint', 'copyright']); }; diff --git a/fxa-auth-db-server/Gruntfile.js b/fxa-auth-db-server/Gruntfile.js deleted file mode 100644 index d32d3a0..0000000 --- a/fxa-auth-db-server/Gruntfile.js +++ /dev/null @@ -1,12 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -module.exports = function (grunt) { - - require('load-grunt-tasks')(grunt) - - grunt.loadTasks('grunttasks') - - grunt.registerTask('default', ['eslint', 'copyright']) -} diff --git a/fxa-auth-db-server/grunttasks/bump.js b/fxa-auth-db-server/grunttasks/bump.js deleted file mode 100644 index fd2a61e..0000000 --- a/fxa-auth-db-server/grunttasks/bump.js +++ /dev/null @@ -1,26 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// takes care of bumping the version number in package.json - -module.exports = function (grunt) { - 'use strict' - - grunt.config('bump', { - options: { - files: ['package.json'], - bumpVersion: true, - commit: true, - commitMessage: 'Release v%VERSION%', - commitFiles: ['package.json', 'CHANGELOG'], - createTag: true, - tagName: 'v%VERSION%', - tagMessage: 'Version %VERSION%', - push: false, - pushTo: 'origin', - gitDescribeOptions: '--tags --always --abrev=1 --dirty=-d' - } - }) -} - diff --git a/fxa-auth-db-server/grunttasks/copyright.js b/fxa-auth-db-server/grunttasks/copyright.js deleted file mode 100644 index 928238c..0000000 --- a/fxa-auth-db-server/grunttasks/copyright.js +++ /dev/null @@ -1,26 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -module.exports = function (grunt) { - 'use strict' - - grunt.config('copyright', { - app: { - src: [ - '{,lib/,scripts/}*.js' - ], - options: { - pattern: 'This Source Code Form is subject to the terms of the Mozilla Public' - } - }, - tests: { - src: [ - 'test/{local,backend}/*.js' - ], - options: { - pattern: 'Any copyright is dedicated to the Public Domain.' - } - } - }) -} diff --git a/fxa-auth-db-server/grunttasks/version.js b/fxa-auth-db-server/grunttasks/version.js deleted file mode 100644 index 4246c34..0000000 --- a/fxa-auth-db-server/grunttasks/version.js +++ /dev/null @@ -1,31 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// -// A task to stamp a new version. -// -// Before running this task you should update CHANGELOG with the -// changes for this release. Protip: you only need to make changes -// to CHANGELOG; this task will add and commit for you. -// -// * version is updated in package.json -// * git tag with version name is created. -// * git commit with updated package.json created. -// -// NOTE: This task will not push this commit for you. -// - -module.exports = function (grunt) { - 'use strict' - - grunt.registerTask('version', [ - 'bump-only:minor', - 'bump-commit' - ]) - - grunt.registerTask('version:patch', [ - 'bump-only:patch', - 'bump-commit' - ]) -} diff --git a/fxa-auth-db-server/package.json b/fxa-auth-db-server/package.json index 5bd1d9c..7d0e425 100644 --- a/fxa-auth-db-server/package.json +++ b/fxa-auth-db-server/package.json @@ -3,10 +3,6 @@ "version": "0.42.0", "description": "Firefox Accounts DB Server", "main": "index.js", - "scripts": { - "test": "grunt && ./scripts/tap-coverage.js test/local", - "outdated": "npm outdated --depth 0" - }, "repository": { "type": "git", "url": "https://github.com/mozilla/fxa-auth-db-server" @@ -20,17 +16,6 @@ "dependencies": { "restify": "2.8.2" }, - "devDependencies": { - "ass": "git://github.com/jrgm/ass.git#5be99ee", - "bluebird": "1.2.2", - "eslint-config-fxa": "1.2.0", - "grunt": "0.4.5", - "grunt-bump": "0.3.0", - "grunt-copyright": "0.2.0", - "grunt-eslint": "14.0.0", - "load-grunt-tasks": "0.6.0", - "tap": "0.4.12" - }, "keywords": [], "engines": { "node": "0.10.x" diff --git a/fxa-auth-db-server/scripts/tap-coverage.js b/fxa-auth-db-server/scripts/tap-coverage.js deleted file mode 100755 index 953157b..0000000 --- a/fxa-auth-db-server/scripts/tap-coverage.js +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env node - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -if (!process.env.NO_COVERAGE) { - var ass = require('ass').enable( { - // exclude files in /client/ and /test/ from code coverage - exclude: [ '/client/', '/test' ] - }) -} - -var path = require('path'), - spawn = require('child_process').spawn, - fs = require('fs') - -var p = spawn(path.join(path.dirname(__dirname), 'node_modules', '.bin', 'tap'), - process.argv.slice(2), { stdio: 'inherit' }) - -p.on('close', function(code) { - if (!process.env.NO_COVERAGE) { - ass.report('json', function(err, r) { - console.log('code coverage:', r.percent + '%') - process.stdout.write('generating coverage.html: ') - var start = new Date() - ass.report('html', function(err, html) { - fs.writeFileSync(path.join(path.dirname(__dirname), 'coverage.html'), - html) - process.stdout.write('complete in ' + - ((new Date() - start) / 1000.0).toFixed(1) + 's\n') - process.exit(code) - }) - }) - } else { - process.exit(code) - } -}) diff --git a/grunttasks/bump.js b/grunttasks/bump.js index 387efb4..74ba6fa 100644 --- a/grunttasks/bump.js +++ b/grunttasks/bump.js @@ -5,7 +5,7 @@ // takes care of bumping the version number in package.json module.exports = function (grunt) { - 'use strict'; + 'use strict' grunt.config('bump', { options: { @@ -13,7 +13,7 @@ module.exports = function (grunt) { bumpVersion: true, commit: true, commitMessage: 'Release v%VERSION%', - commitFiles: ['package.json', 'npm-shrinkwrap.json', 'CHANGELOG'], + commitFiles: ['package.json', 'npm-shrinkwrap.json', 'CHANGELOG-db.md', 'CHANGELOG-server.md'], createTag: true, tagName: 'v%VERSION%', tagMessage: 'Version %VERSION%', @@ -21,6 +21,6 @@ module.exports = function (grunt) { pushTo: 'origin', gitDescribeOptions: '--tags --always --abrev=1 --dirty=-d' } - }); -}; + }) +} diff --git a/grunttasks/copyright.js b/grunttasks/copyright.js index f5e1986..4077091 100644 --- a/grunttasks/copyright.js +++ b/grunttasks/copyright.js @@ -3,12 +3,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ module.exports = function (grunt) { - 'use strict'; + 'use strict' grunt.config('copyright', { app: { src: [ - '{,bin/,config/,db/,scripts/}*.js' + '{bin,config,fxa-auth-db-server/lib,lib,lib/db,scripts}/*.js' ], options: { pattern: 'This Source Code Form is subject to the terms of the Mozilla Public' @@ -16,7 +16,8 @@ module.exports = function (grunt) { }, tests: { src: [ - 'test/{remote,local,backend}/*.js' + 'test/{remote,local,backend}/*.js', + 'fxa-auth-db-server/test/{backend,local}/*.js' ], options: { pattern: 'Any copyright is dedicated to the Public Domain.' diff --git a/fxa-auth-db-server/grunttasks/eslint.js b/grunttasks/eslint.js similarity index 68% rename from fxa-auth-db-server/grunttasks/eslint.js rename to grunttasks/eslint.js index dcf1537..e3585bd 100644 --- a/fxa-auth-db-server/grunttasks/eslint.js +++ b/grunttasks/eslint.js @@ -10,7 +10,11 @@ module.exports = function (grunt) { eslintrc: '.eslintrc' }, files: [ - '{,grunttasks/,lib/,scripts/,test/,test/backend/,test/local/}*.js' + 'index.js', + '{grunttasks,lib,lib/db,scripts,test}/*.js', + 'fxa-auth-db-server/index.js', + 'fxa-auth-db-server/{lib,test,test/backend,test/local}/*.js', + 'test/{backend,local,mem}/*.js' ] }) diff --git a/grunttasks/jshint.js b/grunttasks/jshint.js deleted file mode 100644 index 7929ebf..0000000 --- a/grunttasks/jshint.js +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -module.exports = function (grunt) { - 'use strict'; - - grunt.config('jshint', { - files: [ - '{,bin/,config/,db/,scripts/,test/**/}*.js' - ], - options: { - jshintrc: '.jshintrc' - } - }) -} diff --git a/grunttasks/version.js b/grunttasks/version.js index b51d68a..4246c34 100644 --- a/grunttasks/version.js +++ b/grunttasks/version.js @@ -17,15 +17,15 @@ // module.exports = function (grunt) { - 'use strict'; + 'use strict' grunt.registerTask('version', [ 'bump-only:minor', 'bump-commit' - ]); + ]) grunt.registerTask('version:patch', [ 'bump-only:patch', 'bump-commit' - ]); -}; + ]) +} diff --git a/lib/db/mysql.js b/lib/db/mysql.js index a2b7b76..384b678 100644 --- a/lib/db/mysql.js +++ b/lib/db/mysql.js @@ -67,7 +67,7 @@ module.exports = function (log, error) { ) var pruneIn = options.pruneEvery / 2 + Math.floor(Math.random() * options.pruneEvery) - setTimeout(prune.bind(this), pruneIn).unref(); + setTimeout(prune.bind(this), pruneIn).unref() } // start the pruning off, but only if enabled in config if ( options.enablePruning ) { @@ -521,7 +521,7 @@ module.exports = function (log, error) { var GET_UNLOCK_CODE = 'call unlockCode_1(?)' MySql.prototype.unlockCode = function (uid) { - return this.readFirstResult(GET_UNLOCK_CODE, [uid]); + return this.readFirstResult(GET_UNLOCK_CODE, [uid]) } // Internal diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index cd2a641..9ec4728 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1064,183 +1064,6 @@ } } }, - "grunt-contrib-jshint": { - "version": "0.10.0", - "from": "grunt-contrib-jshint@0.10.0", - "resolved": "https://registry.npmjs.org/grunt-contrib-jshint/-/grunt-contrib-jshint-0.10.0.tgz", - "dependencies": { - "jshint": { - "version": "2.5.11", - "from": "jshint@>=2.5.0 <2.6.0", - "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.5.11.tgz", - "dependencies": { - "cli": { - "version": "0.6.6", - "from": "cli@>=0.6.0 <0.7.0", - "resolved": "https://registry.npmjs.org/cli/-/cli-0.6.6.tgz", - "dependencies": { - "glob": { - "version": "3.2.11", - "from": "glob@>=3.2.1 <3.3.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", - "dependencies": { - "inherits": { - "version": "2.0.1", - "from": "inherits@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" - }, - "minimatch": { - "version": "0.3.0", - "from": "minimatch@>=0.3.0 <0.4.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", - "dependencies": { - "lru-cache": { - "version": "2.6.5", - "from": "lru-cache@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.6.5.tgz" - }, - "sigmund": { - "version": "1.0.1", - "from": "sigmund@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz" - } - } - } - } - } - } - }, - "console-browserify": { - "version": "1.1.0", - "from": "console-browserify@>=1.1.0 <1.2.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", - "dependencies": { - "date-now": { - "version": "0.1.4", - "from": "date-now@>=0.1.4 <0.2.0", - "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz" - } - } - }, - "exit": { - "version": "0.1.2", - "from": "exit@>=0.1.1 <0.2.0", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz" - }, - "htmlparser2": { - "version": "3.8.3", - "from": "htmlparser2@>=3.8.0 <3.9.0", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", - "dependencies": { - "domhandler": { - "version": "2.3.0", - "from": "domhandler@>=2.3.0 <2.4.0", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.3.0.tgz" - }, - "domutils": { - "version": "1.5.1", - "from": "domutils@>=1.5.0 <1.6.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", - "dependencies": { - "dom-serializer": { - "version": "0.1.0", - "from": "dom-serializer@>=0.0.0 <1.0.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", - "dependencies": { - "domelementtype": { - "version": "1.1.3", - "from": "domelementtype@>=1.1.1 <1.2.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz" - }, - "entities": { - "version": "1.1.1", - "from": "entities@>=1.1.1 <1.2.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz" - } - } - } - } - }, - "domelementtype": { - "version": "1.3.0", - "from": "domelementtype@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz" - }, - "readable-stream": { - "version": "1.1.13", - "from": "readable-stream@>=1.1.0 <1.2.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz", - "dependencies": { - "core-util-is": { - "version": "1.0.1", - "from": "core-util-is@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" - }, - "isarray": { - "version": "0.0.1", - "from": "isarray@0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" - }, - "string_decoder": { - "version": "0.10.31", - "from": "string_decoder@>=0.10.0 <0.11.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" - }, - "inherits": { - "version": "2.0.1", - "from": "inherits@>=2.0.1 <2.1.0", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" - } - } - }, - "entities": { - "version": "1.0.0", - "from": "entities@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz" - } - } - }, - "minimatch": { - "version": "1.0.0", - "from": "minimatch@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-1.0.0.tgz", - "dependencies": { - "lru-cache": { - "version": "2.6.5", - "from": "lru-cache@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.6.5.tgz" - }, - "sigmund": { - "version": "1.0.1", - "from": "sigmund@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz" - } - } - }, - "shelljs": { - "version": "0.3.0", - "from": "shelljs@>=0.3.0 <0.4.0", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz" - }, - "strip-json-comments": { - "version": "1.0.2", - "from": "strip-json-comments@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.2.tgz" - }, - "underscore": { - "version": "1.6.0", - "from": "underscore@>=1.6.0 <1.7.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz" - } - } - }, - "hooker": { - "version": "0.2.3", - "from": "hooker@>=0.2.3 <0.3.0", - "resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz" - } - } - }, "grunt-copyright": { "version": "0.2.0", "from": "grunt-copyright@0.2.0", diff --git a/package.json b/package.json index 43b4da2..359088c 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,10 @@ "fxa-auth-db-mysql": "bin/db_patcher.js" }, "scripts": { - "test": "npm run test-mysql && npm run test-mem", - "test-mysql": "grunt && node ./bin/db_patcher.js >/dev/null && ./scripts/tap-coverage.js test/backend test/local", + "test": "npm run test-mysql && npm run test-mem && npm run test-server", + "test-mysql": "grunt && node ./bin/db_patcher.js >/dev/null && ./scripts/tap-coverage.js test/backend test/local", "test-mem": "./scripts/tap-coverage.js test/mem", + "test-server": "./scripts/tap-coverage.js fxa-auth-db-server/test/local", "start": "node ./bin/db_patcher.js >/dev/null && node ./bin/server.js", "start-mem": "node ./bin/mem", "outdated": "npm outdated --depth 0" @@ -36,10 +37,11 @@ }, "devDependencies": { "ass": "git://github.com/jrgm/ass.git#5be99ee", + "eslint-config-fxa": "1.2.0", "grunt": "0.4.5", "grunt-bump": "0.3.0", - "grunt-contrib-jshint": "0.10.0", "grunt-copyright": "0.2.0", + "grunt-eslint": "14.0.0", "grunt-nsp-shrinkwrap": "0.0.3", "load-grunt-tasks": "0.6.0", "mysql-patcher": "0.7.0", diff --git a/scripts/tap-coverage.js b/scripts/tap-coverage.js index 2d884e6..d942a5b 100755 --- a/scripts/tap-coverage.js +++ b/scripts/tap-coverage.js @@ -8,31 +8,31 @@ if (!process.env.NO_COVERAGE) { var ass = require('ass').enable( { // exclude files in /client/ and /test/ from code coverage exclude: [ '/client/', '/test' ] - }); + }) } var path = require('path'), spawn = require('child_process').spawn, - fs = require('fs'); + fs = require('fs') var p = spawn(path.join(path.dirname(__dirname), 'node_modules', '.bin', 'tap'), - process.argv.slice(2), { stdio: 'inherit' }); + process.argv.slice(2), { stdio: 'inherit' }) p.on('close', function(code) { if (!process.env.NO_COVERAGE) { ass.report('json', function(err, r) { - console.log('code coverage:', r.percent + '%'); - process.stdout.write('generating coverage.html: '); - var start = new Date(); + console.log('code coverage:', r.percent + '%') + process.stdout.write('generating coverage.html: ') + var start = new Date() ass.report('html', function(err, html) { fs.writeFileSync(path.join(path.dirname(__dirname), 'coverage.html'), - html); + html) process.stdout.write('complete in ' + - ((new Date() - start) / 1000.0).toFixed(1) + 's\n'); - process.exit(code); - }); - }); + ((new Date() - start) / 1000.0).toFixed(1) + 's\n') + process.exit(code) + }) + }) } else { - process.exit(code); + process.exit(code) } -}); +}) diff --git a/test/local/event_log.js b/test/local/event_log.js index aebc75c..7790be4 100644 --- a/test/local/event_log.js +++ b/test/local/event_log.js @@ -18,7 +18,7 @@ DB.connect(config) test( 'processUnpublishedEvents guards for callback not returning promise', function (t) { - t.plan(2); + t.plan(2) return db.processUnpublishedEvents(function (events) { t.ok(true, 'The db.processUnpublishedEvents callback was called') // ... but the callback itself returns nothing @@ -33,7 +33,7 @@ DB.connect(config) test( 'account activity should generate event logs', function (t) { - t.plan(14); + t.plan(14) var user = fake.newUserDataBuffer() var verifiedUser = fake.newUserDataBuffer() verifiedUser.account.emailVerified = true diff --git a/test/local/log-stats.js b/test/local/log-stats.js index 87c160b..a8a6209 100644 --- a/test/local/log-stats.js +++ b/test/local/log-stats.js @@ -30,7 +30,7 @@ DB.connect(config) test( 'db/mysql logs stats periodically', function (t) { - t.plan(4); + t.plan(4) return dfd.promise .then( function(stats) { diff --git a/test/local/mysql_tests.js b/test/local/mysql_tests.js index 4c9b109..323b110 100644 --- a/test/local/mysql_tests.js +++ b/test/local/mysql_tests.js @@ -16,7 +16,7 @@ DB.connect(config) test( 'ping', function (t) { - t.plan(1); + t.plan(1) return db.ping() .then(function(account) { t.pass('Got the ping ok') @@ -205,15 +205,15 @@ DB.connect(config) var possibleErrors = [ { msg: 'ER_BAD_NULL_ERROR', errno: 1048 }, { msg: 'ER_NO_DEFAULT_FOR_FIELD', errno: 1364 } - ]; - var matchedError = false; + ] + var matchedError = false possibleErrors.forEach(function(possibleErr) { if (err.message === possibleErr.msg) { if (err.errno === possibleErr.errno ) { - matchedError = true; + matchedError = true } } - }); + }) t.ok(matchedError, 'error message and errno are correct') t.end() }) diff --git a/test/local/prune_tokens.js b/test/local/prune_tokens.js index 514f885..2e82355 100644 --- a/test/local/prune_tokens.js +++ b/test/local/prune_tokens.js @@ -18,7 +18,7 @@ DB.connect(config) test( 'ping', function (t) { - t.plan(1); + t.plan(1) return db.ping() .then(function(account) { t.pass('Got the ping ok') @@ -31,7 +31,7 @@ DB.connect(config) test( 'prune tokens', function (t) { - t.plan(9); + t.plan(9) var user = fake.newUserDataBuffer() return db.createAccount(user.accountId, user.account) .then(function() { @@ -52,7 +52,7 @@ DB.connect(config) }) .then(function() { // set pruneLastRun to be zero, so we know it will run - var sql = "UPDATE dbMetadata SET value = '0' WHERE name = 'prune-last-ran'" + var sql = 'UPDATE dbMetadata SET value = \'0\' WHERE name = \'prune-last-ran\'' return db.write(sql, []) }) .then(function() { diff --git a/test/ptaptest.js b/test/ptaptest.js index e5cb569..5db74e3 100644 --- a/test/ptaptest.js +++ b/test/ptaptest.js @@ -29,7 +29,7 @@ */ // support code coverage -require('ass'); +require('ass') var tap = require('tap')