testem 3.17.0 → 3.19.0

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.
Files changed (56) hide show
  1. package/assets/phantom.js +1 -1
  2. package/lib/api.js +1 -1
  3. package/lib/app.js +1 -1
  4. package/lib/browser_launcher.js +1 -1
  5. package/lib/browser_tap_consumer.js +1 -1
  6. package/lib/config.js +10 -7
  7. package/lib/file_watcher.js +1 -1
  8. package/lib/launcher-factory.js +1 -1
  9. package/lib/launcher.js +1 -1
  10. package/lib/process-ctl.js +17 -3
  11. package/lib/reporters/dev/constants.js +1 -1
  12. package/lib/reporters/dev/error_messages_panel.js +1 -1
  13. package/lib/reporters/dev/index.js +1 -1
  14. package/lib/reporters/dev/patchcharm.js +1 -1
  15. package/lib/reporters/dev/runner.js +1 -1
  16. package/lib/reporters/dev/runner_tabs.js +1 -1
  17. package/lib/reporters/dev/screen.js +1 -1
  18. package/lib/reporters/dev/scrollable_text_panel.js +1 -1
  19. package/lib/reporters/dev/split_log_panel.js +1 -1
  20. package/lib/reporters/dev/test_results.js +1 -1
  21. package/lib/reporters/dev/view.js +1 -1
  22. package/lib/reporters/dot_reporter.js +1 -1
  23. package/lib/reporters/index.js +1 -1
  24. package/lib/reporters/tap_reporter.js +1 -1
  25. package/lib/reporters/teamcity_reporter.js +1 -1
  26. package/lib/reporters/xunit_reporter.js +1 -1
  27. package/lib/runners/browser_test_runner.js +1 -1
  28. package/lib/runners/hook_runner.js +1 -1
  29. package/lib/runners/process_test_runner.js +2 -1
  30. package/lib/runners/tap_process_test_runner.js +1 -1
  31. package/lib/runners/to-result.js +1 -1
  32. package/lib/server/index.js +1 -1
  33. package/lib/tap_consumer.js +2 -2
  34. package/lib/utils/add-to-PATH.js +1 -1
  35. package/lib/utils/browser-args.js +1 -1
  36. package/lib/utils/capitalize.js +1 -1
  37. package/lib/utils/chars.js +1 -1
  38. package/lib/utils/clean_exit.js +1 -1
  39. package/lib/utils/current-time.js +1 -1
  40. package/lib/utils/displayutils.js +1 -1
  41. package/lib/utils/env-with-local-path.js +1 -1
  42. package/lib/utils/fileutils.js +11 -6
  43. package/lib/utils/is-node-lt.js +1 -1
  44. package/lib/utils/is-win.js +0 -2
  45. package/lib/utils/isa.js +1 -1
  46. package/lib/utils/known-browsers.js +3 -2
  47. package/lib/utils/log-entry.js +1 -1
  48. package/lib/utils/posix.js +13 -0
  49. package/lib/utils/process.js +18 -7
  50. package/lib/utils/report-file.js +1 -1
  51. package/lib/utils/reporter.js +1 -1
  52. package/lib/utils/run-timeout.js +1 -1
  53. package/lib/utils/signal-listeners.js +1 -1
  54. package/lib/utils/strutils.js +1 -1
  55. package/package.json +12 -12
  56. package/testem.js +1 -1
package/assets/phantom.js CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  var system = require('system');
4
4
  var page = require('webpage').create();
package/lib/api.js CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const log = require('npmlog');
4
4
  const Config = require('./config');
package/lib/app.js CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const EventEmitter = require('events').EventEmitter;
4
4
  const Bluebird = require('bluebird');
@@ -6,7 +6,7 @@ browser_launcher.js
6
6
  This file more or less figures out how to launch any browser on any platform.
7
7
 
8
8
  */
9
- 'use strict';
9
+
10
10
 
11
11
  var Bluebird = require('bluebird');
12
12
 
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const TapConsumer = require('./tap_consumer');
4
4
 
package/lib/config.js CHANGED
@@ -7,14 +7,14 @@ This object returns all config info for the app. It handles reading the `testem.
7
7
  or `testem.json` config file.
8
8
 
9
9
  */
10
- 'use strict';
10
+
11
11
 
12
12
  const os = require('os');
13
13
  const fs = require('fs');
14
14
  const yaml = require('js-yaml');
15
15
  const log = require('npmlog');
16
16
  const path = require('path');
17
- const glob = require('glob');
17
+ const glob = require('glob').glob;
18
18
  const url = require('url');
19
19
  const querystring = require('querystring');
20
20
  const Bluebird = require('bluebird');
@@ -28,7 +28,8 @@ const fileExists = require('./utils/fileutils').fileExists;
28
28
  const _ = require('lodash');
29
29
 
30
30
  const knownBrowsers = require('./utils/known-browsers');
31
- const globAsync = Bluebird.promisify(glob);
31
+ const { convertToPosix } = require('./utils/posix');
32
+ const globAsync = glob;
32
33
 
33
34
  class Config {
34
35
  constructor(appMode, progOptions, config) {
@@ -409,10 +410,12 @@ class Config {
409
410
  return allThatIWant.concat({ src: pattern, attrs: attrs });
410
411
  }
411
412
 
412
- return globAsync(this.resolvePath(pattern), { ignore: dontWant }).then(files => allThatIWant.concat(files.map(f => {
413
- f = this.reverseResolvePath(f);
414
- return { src: f, attrs: attrs };
415
- })));
413
+ return globAsync(convertToPosix(this.resolvePath(pattern)), { ignore: dontWant.map(convertToPosix) })
414
+ .then(files => files.sort())
415
+ .then(files => allThatIWant.concat(files.map(f => {
416
+ f = this.reverseResolvePath(f);
417
+ return { src: f, attrs: attrs };
418
+ })));
416
419
  }, [])
417
420
  .then(result => _.uniqBy(result, 'src'))
418
421
  .asCallback(callback);
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const fireworm = require('fireworm');
4
4
  const EventEmitter = require('events').EventEmitter;
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const Launcher = require('./launcher');
4
4
  const _ = require('lodash');
package/lib/launcher.js CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const log = require('npmlog');
4
4
  const tmp = require('tmp');
@@ -1,7 +1,7 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const log = require('npmlog');
4
- const execa = require('execa');
4
+ const execa = require('execa').execa;
5
5
  const Bluebird = require('bluebird');
6
6
  const util = require('util');
7
7
  const EventEmitter = require('events').EventEmitter;
@@ -11,6 +11,7 @@ const _ = require('lodash');
11
11
  const envWithLocalPath = require('./utils/env-with-local-path');
12
12
  const fileutils = require('./utils/fileutils');
13
13
  const Process = require('./utils/process');
14
+ const isWin = require('./utils/is-win')();
14
15
 
15
16
  const fileExists = fileutils.fileExists;
16
17
  const executableExists = fileutils.executableExists;
@@ -37,7 +38,20 @@ module.exports = class ProcessCtl extends EventEmitter {
37
38
 
38
39
  _spawn(exe, args, options) {
39
40
  log.info('spawning: ' + exe + ' - ' + util.inspect(args));
40
- let p = new Process(this.name, { killTimeout: this.killTimeout }, execa(exe, args, options));
41
+
42
+ // promise should always succeed, Process will uses .on('error') to handle errors
43
+ let process = execa(exe, args, Object.assign({ reject: false }, options));
44
+
45
+ process.then(result => {
46
+ if (result.failed && result.exitCode !== 0 &&
47
+ result.shortMessage.includes(isWin ? 'is not recognized' : 'ENOENT'))
48
+ {
49
+ this.emit('processError', new Error(result.shortMessage), result.stdout, result.stderr);
50
+ }
51
+ return Promise.resolve(result);
52
+ });
53
+
54
+ let p = new Process(this.name, { killTimeout: this.killTimeout }, process);
41
55
  this.emit('processStarted', p);
42
56
  return Bluebird.resolve(p);
43
57
  }
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  exports.TabWidth = 15; // column width of each tab
4
4
  exports.TabStartLine = 4; // row from the top to start drawing tabs
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const ScrollableTextPanel = require('./scrollable_text_panel');
4
4
  const Chars = require('../../utils/chars');
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  /*
4
4
 
@@ -7,7 +7,7 @@ A patch to charm to add text scrolling capability
7
7
  and also a fix to `erase()`.
8
8
 
9
9
  */
10
- 'use strict';
10
+
11
11
 
12
12
  const charm = require('charm');
13
13
  const Charm = charm.Charm;
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const Backbone = require('backbone');
4
4
  const TestResults = require('./test_results');
@@ -7,7 +7,7 @@ Implementation of the tabbed UI. Each tab contains its own log panel.
7
7
  When the tab is not selected, it hides the associated log panel.
8
8
 
9
9
  */
10
- 'use strict';
10
+
11
11
 
12
12
  const SplitLogPanel = require('./split_log_panel');
13
13
  const View = require('./view');
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  let charm;
4
4
 
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  var View = require('./view');
4
4
  var splitLines = require('../../utils/strutils').splitLines;
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  var View = require('./view');
4
4
  var ScrollableTextPanel = require('./scrollable_text_panel');
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  var Backbone = require('backbone');
4
4
 
@@ -5,7 +5,7 @@ view.js
5
5
 
6
6
  Base-class for our view-models.
7
7
  */
8
- 'use strict';
8
+
9
9
 
10
10
  var Backbone = require('backbone');
11
11
 
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const indent = require('../utils/strutils').indent;
4
4
  const printf = require('printf');
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  module.exports = {
4
4
  tap: require('./tap_reporter'),
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const displayutils = require('../utils/displayutils');
4
4
 
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  function namify(prefix, result) {
4
4
  let line = (prefix ? (prefix + ' - ') : '') +
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  var XmlDom = require('@xmldom/xmldom');
4
4
  var indent = require('../utils/strutils').indent;
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const log = require('npmlog');
4
4
  const BrowserTapConsumer = require('../browser_tap_consumer');
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const Bluebird = require('bluebird');
4
4
  const log = require('npmlog');
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
  var Bluebird = require('bluebird');
3
3
 
4
4
  var toResult = require('./to-result');
@@ -21,6 +21,7 @@ class ProcessTestRunner {
21
21
  this.process = testProcess;
22
22
  this.process.once('processExit', this.onProcessExit.bind(this));
23
23
  this.process.once('processError', this.onProcessError.bind(this));
24
+ return Promise.resolve(testProcess);
24
25
  }).catch(reject);
25
26
  }).asCallback(onFinish);
26
27
  }
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  var TapConsumer = require('../tap_consumer');
4
4
  var log = require('npmlog');
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const log = require('npmlog');
4
4
 
@@ -7,7 +7,7 @@ Testem's server. Serves up the HTML, JS, and CSS required for
7
7
  running the tests in a browser.
8
8
 
9
9
  */
10
- 'use strict';
10
+
11
11
 
12
12
  var express = require('express');
13
13
  var socketIO = require('socket.io');
@@ -1,7 +1,7 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const yaml = require('js-yaml');
4
- const extend = require('util')._extend;
4
+ const extend = Object.assign;
5
5
  const EventEmitter = require('events').EventEmitter;
6
6
  const TapParser = require('tap-parser');
7
7
  const log = require('npmlog');
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const _ = require('lodash');
4
4
  const isWin = require('./is-win')();
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const capitalize = require('./capitalize');
4
4
  const log = require('npmlog');
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  module.exports = str => {
4
4
  if (typeof str !== 'string') { return; }
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const isWin = require('./is-win')();
4
4
 
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  module.exports = function cleanExit(code) {
4
4
  // Workaround for this node core bug <https://github.com/joyent/node/issues/3584>
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  function currentTimeAsLocaleTimeString() {
4
4
  let dateTime = new Date();
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  // Method to format test results.
4
4
  const strutils = require('./strutils');
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const path = require('path');
4
4
  const fs = require('fs');
@@ -1,7 +1,7 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const fs = require('fs');
4
- const execa = require('execa');
4
+ const execa = require('execa').execa;
5
5
  const Bluebird = require('bluebird');
6
6
  const log = require('npmlog');
7
7
 
@@ -15,9 +15,14 @@ exports.fileExists = function fileExists(path) {
15
15
 
16
16
  exports.executableExists = function executableExists(exe, options) {
17
17
  let cmd = isWin ? 'where' : 'which';
18
- let test = execa(cmd, [exe], options);
19
-
20
- test.on('error', error => log.error('Error spawning "' + cmd + exe + '"', error));
18
+ let test = execa(cmd, [exe], Object.assign({ reject: false }, options));
21
19
 
22
- return test.then(result => result.code === 0, () => false);
20
+ return test.then(result => {
21
+ if (result.exitCode === 0) {
22
+ return true;
23
+ } else if (!result.exitCode) {
24
+ log.error('Error spawning "' + cmd + ' ' + exe + '"', result);
25
+ }
26
+ return false;
27
+ });
23
28
  };
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  module.exports = version => {
4
4
  let nodeVer = process.version.substr(1).split('.').map(num => parseInt(num, 10));
@@ -1,5 +1,3 @@
1
- 'use strict';
2
-
3
1
  function test(platform) {
4
2
  return /^win/.test(platform);
5
3
  }
package/lib/utils/isa.js CHANGED
@@ -11,7 +11,7 @@ Examples:
11
11
  isa("abc", String) // true
12
12
 
13
13
  */
14
- 'use strict';
14
+
15
15
 
16
16
  const toString = Object.prototype.toString;
17
17
 
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const browserArgs = require('./browser-args');
4
4
  const path = require('path');
@@ -84,6 +84,7 @@ function firefoxPaths() {
84
84
  return [
85
85
  'C:\\Program Files\\Mozilla Firefox\\firefox.exe',
86
86
  'C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe',
87
+ 'C:\\Users\\' + process.env.USERNAME + '\\AppData\\Local\\Mozilla Firefox\\firefox.exe',
87
88
  process.env.HOME + '/Applications/Firefox.app/Contents/MacOS/firefox',
88
89
  '/Applications/Firefox.app/Contents/MacOS/firefox'
89
90
  ];
@@ -144,7 +145,7 @@ module.exports = function knownBrowsers(platform, config) {
144
145
  possibleExe: 'firefox',
145
146
 
146
147
  args(config, url) {
147
- return ['-profile', '--headless', this.browserTmpDir(), url];
148
+ return ['-profile', '-headless', this.browserTmpDir(), url];
148
149
  },
149
150
  setup(config, done) {
150
151
  firefoxSetup(this.browserTmpDir(), config, done);
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  /**
4
4
  * A class to a single log entry.
@@ -0,0 +1,13 @@
1
+ const isWin = require('./is-win');
2
+
3
+ module.exports = {
4
+ isPosix(path) {
5
+ return path.includes('/') && !path.includes('\\');
6
+ },
7
+ convertToPosix(path) {
8
+ if (isWin()) {
9
+ return path.replace(/\\/g, '/');
10
+ }
11
+ return path;
12
+ }
13
+ };
@@ -1,6 +1,4 @@
1
- 'use strict';
2
-
3
- const execa = require('execa');
1
+ const execa = require('execa').execa;
4
2
  const log = require('npmlog');
5
3
  const Bluebird = require('bluebird');
6
4
  const EventEmitter = require('events').EventEmitter;
@@ -29,6 +27,15 @@ module.exports = class Process extends EventEmitter {
29
27
 
30
28
  this.process.on('close', this.onClose.bind(this));
31
29
  this.process.on('error', this.onError.bind(this));
30
+
31
+ this.process.then(result => {
32
+ if (result.failed && result.exitCode !== 0 &&
33
+ result.shortMessage.includes(isWin ? 'is not recognized' : 'ENOENT'))
34
+ {
35
+ this.onError(new Error(result.shortMessage), this.stdout, this.stderr);
36
+ }
37
+ return Promise.resolve(result);
38
+ });
32
39
  }
33
40
 
34
41
  onKillTimeout() {
@@ -48,7 +55,7 @@ module.exports = class Process extends EventEmitter {
48
55
 
49
56
  onError(error) {
50
57
  log.warn(this.name + ' errored', error);
51
- this.process = null;
58
+ // this.process = null;
52
59
  this.exitCode = 1;
53
60
  this.emit('processError', error, this.stdout, this.stderr);
54
61
  }
@@ -132,14 +139,18 @@ function kill(p, sig) {
132
139
  args.push('/f');
133
140
  }
134
141
 
135
- execa(command, args).then(result => {
142
+ const killProcess = execa(command, args, { reject: false });
143
+
144
+ killProcess.on('error', err => {
145
+ log.error(err);
146
+ });
147
+
148
+ killProcess.then(result => {
136
149
  // Processes without windows can't be killed without /F, detect and force
137
150
  // kill them directly
138
151
  if (result.stderr.indexOf('can only be terminated forcefully') !== -1) {
139
152
  kill(p, 'SIGKILL');
140
153
  }
141
- }).catch(err => {
142
- log.error(err);
143
154
  });
144
155
  } else {
145
156
  p.kill(sig);
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const Bluebird = require('bluebird');
4
4
  const log = require('npmlog');
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const Bluebird = require('bluebird');
4
4
  const EventEmitter = require('events').EventEmitter;
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  const Bluebird = require('bluebird');
4
4
  const EventEmitter = require('events').EventEmitter;
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+
2
2
 
3
3
  // String padding function adapted from <http://jsfromhell.com/string/pad>
4
4
  exports.pad = function pad(str, l, s, t) {
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "unittest",
8
8
  "browser"
9
9
  ],
10
- "version": "3.17.0",
10
+ "version": "3.19.0",
11
11
  "author": "Toby Ho <airportyh@gmail.com>",
12
12
  "repository": {
13
13
  "type": "git",
@@ -28,10 +28,10 @@
28
28
  "commander": "^2.6.0",
29
29
  "compression": "^1.7.4",
30
30
  "consolidate": "^0.16.0",
31
- "execa": "^1.0.0",
31
+ "execa": "^9.6.1",
32
32
  "express": "^4.10.7",
33
33
  "fireworm": "^0.7.2",
34
- "glob": "^7.0.4",
34
+ "glob": "^13.0.6",
35
35
  "http-proxy": "^1.13.1",
36
36
  "js-yaml": "^3.2.5",
37
37
  "lodash": "^4.17.21",
@@ -40,12 +40,12 @@
40
40
  "node-notifier": "^10.0.0",
41
41
  "npmlog": "^6.0.0",
42
42
  "printf": "^0.6.1",
43
- "rimraf": "^3.0.2",
43
+ "rimraf": "^6.1.3",
44
44
  "socket.io": "^4.5.4",
45
45
  "spawn-args": "^0.2.0",
46
46
  "styled_string": "0.0.1",
47
47
  "tap-parser": "^7.0.0",
48
- "tmp": "0.0.33"
48
+ "tmp": "^0.2.5"
49
49
  },
50
50
  "files": [
51
51
  "lib",
@@ -67,20 +67,20 @@
67
67
  "devDependencies": {
68
68
  "bluebird-retry": "^0.11.0",
69
69
  "browserify": "^17.0.0",
70
- "chai": "^4.0.2",
70
+ "chai": "^6.2.2",
71
71
  "chai-files": "^1.2.0",
72
72
  "chai-shallow-deep-equal": "^1.4.4",
73
73
  "cheerio": "1.0.0-rc.12",
74
- "dirty-chai": "^2.0.0",
75
- "eslint": "^8.12.0",
76
- "eslint-plugin-chai-expect": "^3.0.0",
77
- "eslint-plugin-mocha": "^10.0.3",
78
- "mocha": "^9.2.0",
74
+ "dirty-chai": "^3.0.0",
75
+ "eslint": "^9.39.4",
76
+ "eslint-plugin-chai-expect": "^3.1.0",
77
+ "eslint-plugin-mocha": "^11.2.0",
78
+ "mocha": "^11.7.5",
79
79
  "request": "^2.51.0",
80
80
  "saucie": "^3.3.3",
81
81
  "shelljs": "^0.8.2",
82
82
  "sinon": "10.0.0",
83
- "sinon-chai": "^3.2.0",
83
+ "sinon-chai": "^4.0.1",
84
84
  "socket.io-client": "^4.1.2",
85
85
  "tape": "^5.2.2"
86
86
  },
package/testem.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';
2
+
3
3
 
4
4
  const program = require('commander');
5
5
  let progOptions = program;