testem 3.2.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Got Scripts? Test’em!
2
2
  =================
3
3
 
4
- [![Build Status](https://travis-ci.org/testem/testem.svg?branch=master)](https://travis-ci.org/testem/testem) [![Dependency Status](https://david-dm.org/testem/testem.svg)](https://david-dm.org/testem/testem) [![npm version](https://badge.fury.io/js/testem.svg)](http://badge.fury.io/js/testem) [![Windows build status](https://ci.appveyor.com/api/projects/status/l948rc4rv391ayge/branch/master?svg=true)](https://ci.appveyor.com/project/johanneswuerbach/testem/branch/master)
4
+ [![Build Status](https://github.com/testem/testem/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/testem/testem/actions/workflows/ci.yml?query=branch%3Amaster) [![npm version](https://badge.fury.io/js/testem.svg)](http://badge.fury.io/js/testem)
5
5
 
6
6
  Unit testing in Javascript can be tedious and painful, but Testem makes it so easy that you will actually *want* to write tests.
7
7
 
package/lib/config.js CHANGED
@@ -125,7 +125,7 @@ class Config {
125
125
  if (callback) {
126
126
  callback.call(this);
127
127
  }
128
- } else if (configFile.match(/\.js$/)) {
128
+ } else if (configFile.match(/\.c?js$/)) {
129
129
  this.readJS(configFile, callback);
130
130
  } else if (configFile.match(/\.json$/)) {
131
131
  this.readJSON(configFile, callback);
@@ -2,6 +2,7 @@
2
2
 
3
3
  const indent = require('../utils/strutils').indent;
4
4
  const printf = require('printf');
5
+ const displayutils = require('../utils/displayutils');
5
6
 
6
7
  module.exports = class DotReporter {
7
8
  constructor(silent, out) {
@@ -98,7 +99,11 @@ module.exports = class DotReporter {
98
99
  }
99
100
 
100
101
  summaryDisplay() {
101
- return printf(' %d tests complete (%d ms)', this.total, this.duration());
102
+ let lines = [
103
+ `[duration - ${this.duration()} ms]`,
104
+ displayutils.summaryDisplay.call(this),
105
+ ];
106
+ return lines.join('\n');
102
107
  }
103
108
 
104
109
  duration() {
@@ -38,20 +38,7 @@ module.exports = class TapReporter {
38
38
  }
39
39
 
40
40
  summaryDisplay() {
41
- let lines = [
42
- '1..' + this.total,
43
- '# tests ' + this.total,
44
- '# pass ' + this.pass,
45
- '# skip ' + this.skipped,
46
- '# todo ' + this.todo,
47
- '# fail ' + (this.total - this.pass - this.skipped - this.todo)
48
- ];
49
-
50
- if (this.pass + this.skipped + this.todo === this.total) {
51
- lines.push('');
52
- lines.push('# ok');
53
- }
54
- return lines.join('\n');
41
+ return displayutils.summaryDisplay.call(this);
55
42
  }
56
43
 
57
44
  /*
@@ -78,7 +78,7 @@ module.exports = function toResult(launcherId, err, code, runnerProcess, config,
78
78
  message += 'Stdout: \n ' + runnerProcess.stdout + '\n';
79
79
  }
80
80
 
81
- if (config && config.get('debug')) {
81
+ if (config && config.get('debug') && runnerProcess && runnerProcess.name) {
82
82
  log.info(runnerProcess.name + '.stdout', runnerProcess.stdout);
83
83
  log.info(runnerProcess.name + '.stderr', runnerProcess.stderr);
84
84
  }
@@ -64,9 +64,15 @@ function yamlDisplay(err, logs) {
64
64
  .map(key => key + ': >\n' + strutils.indent(String(err[key])));
65
65
  if (logs) {
66
66
  testLogs = ['browser log: |'].concat(
67
- logs.map(
68
- log => strutils.indent(log.toString())
69
- )
67
+ logs.map((log) => {
68
+ let logLine;
69
+ if (strutils.isString(log)) {
70
+ logLine = log;
71
+ } else {
72
+ logLine = JSON.stringify(log);
73
+ }
74
+ return strutils.indent(logLine);
75
+ })
70
76
  );
71
77
  } else {
72
78
  testLogs = [];
@@ -87,3 +93,22 @@ function resultString(id, prefix, result, quietLogs, strictSpecCompliance) {
87
93
  }
88
94
 
89
95
  exports.resultString = resultString;
96
+
97
+ function summaryDisplay() {
98
+ let lines = [
99
+ '1..' + this.total,
100
+ '# tests ' + this.total,
101
+ '# pass ' + this.pass,
102
+ '# skip ' + this.skipped,
103
+ '# todo ' + this.todo,
104
+ '# fail ' + (this.total - this.pass - this.skipped - this.todo)
105
+ ];
106
+
107
+ if (this.pass + this.skipped + this.todo === this.total) {
108
+ lines.push('');
109
+ lines.push('# ok');
110
+ }
111
+ return lines.join('\n');
112
+ }
113
+
114
+ exports.summaryDisplay = summaryDisplay;
@@ -71,6 +71,15 @@ function headlessBraveArgs(browserTmpDir, url) {
71
71
  '--window-size=1440,900'].concat(braveArgs(browserTmpDir, url));
72
72
  }
73
73
 
74
+ function edgePaths() {
75
+ return [
76
+ 'C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe',
77
+ 'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe',
78
+ process.env.HOME + '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge',
79
+ '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge'
80
+ ];
81
+ }
82
+
74
83
  function firefoxPaths() {
75
84
  return [
76
85
  'C:\\Program Files\\Mozilla Firefox\\firefox.exe',
@@ -237,6 +246,20 @@ module.exports = function knownBrowsers(platform, config) {
237
246
  return chromeArgs(this.browserTmpDir(), url);
238
247
  }
239
248
  },
249
+ {
250
+ name: 'Edge',
251
+ possiblePath: edgePaths(),
252
+ args(config, url) {
253
+ return chromeArgs(this.browserTmpDir(), url);
254
+ }
255
+ },
256
+ {
257
+ name: 'Headless Edge',
258
+ possiblePath: edgePaths(),
259
+ args(config, url) {
260
+ return headlessChromeArgs(this.browserTmpDir(), url);
261
+ }
262
+ },
240
263
  {
241
264
  name: 'Safari',
242
265
  possiblePath: [
@@ -38,3 +38,7 @@ exports.template = function template(str, params) {
38
38
  return name in params ? params[name] : unchanged;
39
39
  });
40
40
  };
41
+
42
+ exports.isString = function(x) {
43
+ return Object.prototype.toString.call(x) === '[object String]';
44
+ };
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "unittest",
8
8
  "browser"
9
9
  ],
10
- "version": "3.2.0",
10
+ "version": "3.4.1",
11
11
  "author": "Toby Ho <airportyh@gmail.com>",
12
12
  "repository": {
13
13
  "type": "git",
@@ -40,16 +40,16 @@
40
40
  "lodash.uniqby": "^4.7.0",
41
41
  "mkdirp": "^0.5.1",
42
42
  "mustache": "^3.0.0",
43
- "node-notifier": "^5.0.1",
43
+ "node-notifier": "^9.0.1",
44
44
  "npmlog": "^4.0.0",
45
- "printf": "^0.5.1",
45
+ "printf": "^0.6.1",
46
46
  "rimraf": "^2.4.4",
47
47
  "socket.io": "^2.1.0",
48
48
  "spawn-args": "^0.2.0",
49
49
  "styled_string": "0.0.1",
50
50
  "tap-parser": "^7.0.0",
51
51
  "tmp": "0.0.33",
52
- "xmldom": "^0.1.19"
52
+ "xmldom": "^0.6.0"
53
53
  },
54
54
  "files": [
55
55
  "lib",
@@ -62,7 +62,7 @@
62
62
  ],
63
63
  "scripts": {
64
64
  "install:all": "npm install && npm install phantomjs-prebuilt",
65
- "test": "mocha --opts tests/mocha.opts tests/*_tests.js tests/**/*_tests.js",
65
+ "test": "mocha tests/*_tests.js tests/**/*_tests.js",
66
66
  "cover": "cover run ./node_modules/.bin/_mocha tests/*_tests.js tests/**/*_tests.js; cover report html; open cover_html/index.html",
67
67
  "integration": "node ./bin/run-integration.js",
68
68
  "browser-tests": "cd examples/saucelabs/ && ../../testem.js ci -d",
@@ -77,16 +77,16 @@
77
77
  "cheerio": "^1.0.0-rc.2",
78
78
  "dirty-chai": "^2.0.0",
79
79
  "eslint": "^5.0.0",
80
- "eslint-plugin-chai-expect": "^1.1.1",
80
+ "eslint-plugin-chai-expect": "^2.2.0",
81
81
  "eslint-plugin-mocha": "^5.0.0",
82
- "mocha": "^3.0.0",
82
+ "mocha": "^8.3.2",
83
83
  "phantomjs": "^2.1.7",
84
84
  "request": "^2.51.0",
85
85
  "saucie": "^3.3.3",
86
86
  "shelljs": "^0.8.2",
87
- "sinon": "^7.2.3",
87
+ "sinon": "^10.0.0",
88
88
  "sinon-chai": "^3.2.0",
89
- "tape": "^4.9.1"
89
+ "tape": "^5.2.2"
90
90
  },
91
91
  "bin": {
92
92
  "testem": "./testem.js"
@@ -101,7 +101,9 @@ function getBrowserName(userAgent) {
101
101
  return ['Opera', m[2]].join(' ');
102
102
  }],
103
103
  /(Opera).*Version\/([0-9]+\.[0-9]+)/,
104
- /(Edge)\/([0-9]+\.[0-9]+)/,
104
+ [/(Edg)\/([0-9]+\.[0-9]+)/, function(m) {
105
+ return ['Edge', m[2]].join(' ');
106
+ }],
105
107
  /(Chrome)\/([0-9]+\.[0-9]+)/,
106
108
  /(Firefox)\/([0-9a-z]+\.[0-9a-z]+)/,
107
109
  /(PhantomJS)\/([0-9]+\.[0-9]+)/,