node-qunit-phantomjs
Advanced tools
+16
-10
@@ -8,2 +8,14 @@ { | ||
| "extends": "eslint:recommended", | ||
| // Stop ESLint from looking for a configuration file in parent folders | ||
| "root": true, | ||
| "parser": "babel-eslint", | ||
| "parserOptions": { | ||
| "ecmaVersion": 8, | ||
| "sourceType": "script", | ||
| "ecmaFeatures": { | ||
| "experimentalObjectRestSpread": true | ||
| } | ||
| }, | ||
| "rules": { | ||
@@ -46,7 +58,2 @@ "block-scoped-var": 2, | ||
| "strict": [ | ||
| 2, | ||
| "global" | ||
| ], | ||
| "no-shadow": 2, | ||
@@ -129,5 +136,6 @@ "no-use-before-define": 2, | ||
| "new-parens": 2, | ||
| "newline-after-var": [ | ||
| 1, | ||
| "always" | ||
| "padding-line-between-statements": [ | ||
| "error", | ||
| { "blankLine": "always", "prev": ["const", "let", "var"], "next": "*"}, | ||
| { "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"]} | ||
| ], | ||
@@ -137,3 +145,2 @@ "no-array-constructor": 2, | ||
| "no-lonely-if": 1, | ||
| "no-multi-spaces": 1, | ||
| "no-multiple-empty-lines": 1, | ||
@@ -148,3 +155,2 @@ "no-new-object": 2, | ||
| ], | ||
| "one-var": 1, | ||
| "operator-assignment": [ | ||
@@ -151,0 +157,0 @@ 1, |
+24
-30
@@ -1,21 +0,17 @@ | ||
| 'use strict'; | ||
| const path = require('path'); | ||
| const chalk = require('chalk'); | ||
| const childProcess = require('child_process'); | ||
| const phantomjs = require('phantomjs-prebuilt'); | ||
| const binPath = phantomjs.path; | ||
| const phantomjsRunnerDir = path.dirname(require.resolve('qunit-phantomjs-runner')); | ||
| const isUrl = uri => uri.match(/^http(s?):/) !== null; | ||
| var path = require('path'), | ||
| chalk = require('chalk'), | ||
| childProcess = require('child_process'), | ||
| phantomjs = require('phantomjs-prebuilt'), | ||
| binPath = phantomjs.path, | ||
| phantomjsRunnerDir = path.dirname(require.resolve('qunit-phantomjs-runner')), | ||
| isUrl = function (uri) { | ||
| return uri.match(/^http(s?):/) !== null; | ||
| }; | ||
| module.exports = (uri, options, callback) => { | ||
| const opt = options || {}; | ||
| const cb = callback || (() => {}); | ||
| let runner = path.join(phantomjsRunnerDir, 'runner-json.js'); | ||
| const testUri = isUrl(uri) ? uri : `file:///${path.resolve(uri).replace(/\\/g, '/')}`; | ||
| let childArgs = []; | ||
| let proc; | ||
| module.exports = function (uri, options, callback) { | ||
| var opt = options || {}, | ||
| cb = callback || function () {}, | ||
| runner = path.join(phantomjsRunnerDir, 'runner-json.js'), | ||
| testUri = isUrl(uri) ? uri : 'file:///' + path.resolve(uri).replace(/\\/g, '/'), | ||
| childArgs = [], | ||
| proc; | ||
| if (opt.verbose) { | ||
@@ -55,3 +51,3 @@ runner = path.join(phantomjsRunnerDir, 'runner-list.js'); | ||
| console.log('Testing ' + chalk.blue(testUri)); | ||
| console.log(`Testing ${chalk.blue(testUri)}`); | ||
@@ -61,7 +57,7 @@ // phantomjs [phantomjs-options] runner testuri [timeout [page]] | ||
| proc.stdout.on('data', function (data) { | ||
| var out, | ||
| test, | ||
| message, | ||
| line = data.toString().trim(); | ||
| proc.stdout.on('data', data => { | ||
| let out; | ||
| let test; | ||
| let message; | ||
| const line = data.toString().trim(); | ||
@@ -77,3 +73,3 @@ try { | ||
| for (test in out.exceptions) { | ||
| console.log('\n' + chalk.red('Test failed') + ': ' + chalk.red(test) + ': \n' + out.exceptions[test].join('\n ')); | ||
| console.log(`\n${chalk.red('Test failed')}: ${chalk.red(test)}: \n${out.exceptions[test].join('\n ')}`); | ||
| } | ||
@@ -83,3 +79,3 @@ } | ||
| if (out.result) { | ||
| message = 'Took ' + out.result.runtime + ' ms to run ' + out.result.total + ' tests. ' + out.result.passed + ' passed, ' + out.result.failed + ' failed.'; | ||
| message = `Took ${out.result.runtime} ms to run ${out.result.total} tests. ${out.result.passed} passed, ${out.result.failed} failed.`; | ||
@@ -90,9 +86,7 @@ console.log(out.result.failed > 0 ? chalk.red(message) : chalk.green(message)); | ||
| proc.stderr.on('data', function (data) { | ||
| proc.stderr.on('data', data => { | ||
| console.log(data.toString().trim()); | ||
| }); | ||
| proc.on('close', function (code) { | ||
| return cb(code); | ||
| }); | ||
| proc.on('close', code => cb(code)); | ||
| }; |
+5
-4
| { | ||
| "name": "node-qunit-phantomjs", | ||
| "version": "2.1.0", | ||
| "version": "2.1.1", | ||
| "description": "Run QUnit unit tests in a headless PhantomJS instance without using Grunt.", | ||
@@ -26,8 +26,9 @@ "main": "index.js", | ||
| "dependencies": { | ||
| "chalk": "^2.4.2", | ||
| "chalk": "^3.0.0", | ||
| "minimist": "^1.2.0", | ||
| "phantomjs-prebuilt": "^2.1.16", | ||
| "qunit-phantomjs-runner": "^2.4.0" | ||
| "qunit-phantomjs-runner": "^2.4.1" | ||
| }, | ||
| "devDependencies": { | ||
| "babel-eslint": "^10.0.3", | ||
| "gulp": "^4.0.2", | ||
@@ -38,3 +39,3 @@ "gulp-eslint": "^6.0.0", | ||
| "qunit": "^2.9.3", | ||
| "strip-ansi": "^5.2.0" | ||
| "strip-ansi": "^6.0.0" | ||
| }, | ||
@@ -41,0 +42,0 @@ "bin": { |
12511
2.27%7
16.67%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated