testem 3.18.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.
- package/lib/config.js +9 -6
- package/lib/process-ctl.js +16 -2
- package/lib/runners/process_test_runner.js +1 -0
- package/lib/tap_consumer.js +1 -1
- package/lib/utils/fileutils.js +11 -6
- package/lib/utils/is-win.js +0 -2
- package/lib/utils/known-browsers.js +2 -1
- package/lib/utils/posix.js +13 -0
- package/lib/utils/process.js +18 -7
- package/package.json +4 -4
package/lib/config.js
CHANGED
|
@@ -14,7 +14,7 @@ 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
|
|
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
|
|
413
|
-
|
|
414
|
-
|
|
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);
|
package/lib/process-ctl.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
-
|
|
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
|
}
|
|
@@ -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
|
}
|
package/lib/tap_consumer.js
CHANGED
package/lib/utils/fileutils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
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.
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
let test = execa(cmd, [exe], Object.assign({ reject: false }, options));
|
|
19
|
+
|
|
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
|
};
|
package/lib/utils/is-win.js
CHANGED
|
@@ -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', '
|
|
148
|
+
return ['-profile', '-headless', this.browserTmpDir(), url];
|
|
148
149
|
},
|
|
149
150
|
setup(config, done) {
|
|
150
151
|
firefoxSetup(this.browserTmpDir(), config, done);
|
package/lib/utils/process.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
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
|
|
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);
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"unittest",
|
|
8
8
|
"browser"
|
|
9
9
|
],
|
|
10
|
-
"version": "3.
|
|
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": "^
|
|
31
|
+
"execa": "^9.6.1",
|
|
32
32
|
"express": "^4.10.7",
|
|
33
33
|
"fireworm": "^0.7.2",
|
|
34
|
-
"glob": "^
|
|
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,7 +40,7 @@
|
|
|
40
40
|
"node-notifier": "^10.0.0",
|
|
41
41
|
"npmlog": "^6.0.0",
|
|
42
42
|
"printf": "^0.6.1",
|
|
43
|
-
"rimraf": "^
|
|
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",
|