testem 3.15.2 → 3.17.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 +3 -3
- package/lib/runners/browser_test_runner.js +8 -0
- package/lib/server/index.js +3 -3
- package/lib/utils/reporter.js +8 -0
- package/package.json +1 -1
- package/testem.js +2 -0
package/lib/config.js
CHANGED
|
@@ -70,7 +70,7 @@ class Config {
|
|
|
70
70
|
|
|
71
71
|
// Try all testem.json, testem.yml and testem.js
|
|
72
72
|
// testem.json gets precedence
|
|
73
|
-
let files = ['testem.json', '.testem.json', '.testem.yml', 'testem.yml', 'testem.js', '.testem.js'];
|
|
73
|
+
let files = ['testem.json', '.testem.json', '.testem.yml', 'testem.yml', 'testem.js', '.testem.js', 'testem.cjs', '.testem.cjs'];
|
|
74
74
|
return Bluebird.filter(files.map(this.resolveConfigPath.bind(this)), fileExists).then(matched => {
|
|
75
75
|
let configFile = matched[0];
|
|
76
76
|
if (matched.length > 1) {
|
|
@@ -406,12 +406,12 @@ class Config {
|
|
|
406
406
|
if (patternUrl.protocol === 'file:') {
|
|
407
407
|
pattern = patternUrl.hostname + patternUrl.path;
|
|
408
408
|
} else if (patternUrl.protocol) {
|
|
409
|
-
return allThatIWant.concat({src: pattern, attrs: attrs});
|
|
409
|
+
return allThatIWant.concat({ src: pattern, attrs: attrs });
|
|
410
410
|
}
|
|
411
411
|
|
|
412
412
|
return globAsync(this.resolvePath(pattern), { ignore: dontWant }).then(files => allThatIWant.concat(files.map(f => {
|
|
413
413
|
f = this.reverseResolvePath(f);
|
|
414
|
-
return {src: f, attrs: attrs};
|
|
414
|
+
return { src: f, attrs: attrs };
|
|
415
415
|
})));
|
|
416
416
|
}, [])
|
|
417
417
|
.then(result => _.uniqBy(result, 'src'))
|
|
@@ -142,6 +142,7 @@ module.exports = class BrowserTestRunner {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
let tap = new BrowserTapConsumer(socket);
|
|
145
|
+
tap.on('tests-start', this.onTestsStart.bind(this));
|
|
145
146
|
tap.on('test-result', this.onTestResult.bind(this));
|
|
146
147
|
tap.on('all-test-results', this.onAllTestResults.bind(this));
|
|
147
148
|
tap.on('all-test-results', () => {
|
|
@@ -165,8 +166,15 @@ module.exports = class BrowserTestRunner {
|
|
|
165
166
|
|
|
166
167
|
onTestsStart(testData) {
|
|
167
168
|
if (testData) {
|
|
169
|
+
Object.assign(testData, {
|
|
170
|
+
launcherId: this.launcherId,
|
|
171
|
+
});
|
|
172
|
+
|
|
168
173
|
this.currentTestContext = testData;
|
|
169
174
|
this.currentTestContext.state = 'executing';
|
|
175
|
+
if (this.reporter.testStarted) {
|
|
176
|
+
this.reporter.testStarted(this.launcher.name, testData);
|
|
177
|
+
}
|
|
170
178
|
}
|
|
171
179
|
}
|
|
172
180
|
|
package/lib/server/index.js
CHANGED
|
@@ -171,7 +171,7 @@ class Server extends EventEmitter {
|
|
|
171
171
|
|
|
172
172
|
configureExpress(app) {
|
|
173
173
|
app.engine('mustache', Mustache);
|
|
174
|
-
app.set('view options', {layout: false});
|
|
174
|
+
app.set('view options', { layout: false });
|
|
175
175
|
app.set('etag', 'strong');
|
|
176
176
|
app.use((req, res, next) => {
|
|
177
177
|
if (this.ieCompatMode) {
|
|
@@ -215,7 +215,7 @@ class Server extends EventEmitter {
|
|
|
215
215
|
configureProxy(app) {
|
|
216
216
|
var proxies = this.config.get('proxies');
|
|
217
217
|
if (proxies) {
|
|
218
|
-
this.proxy = new httpProxy.createProxyServer({changeOrigin: true});
|
|
218
|
+
this.proxy = new httpProxy.createProxyServer({ changeOrigin: true });
|
|
219
219
|
|
|
220
220
|
this.proxy.on('error', (err, req, res) => {
|
|
221
221
|
res && res.status && res.status(500).json(err);
|
|
@@ -384,7 +384,7 @@ class Server extends EventEmitter {
|
|
|
384
384
|
if (stat.isDirectory()) {
|
|
385
385
|
fs.readdir(filePath, (err, files) => {
|
|
386
386
|
var dirListingPage = `${__dirname}/../../views/directorylisting.mustache`;
|
|
387
|
-
res.render(dirListingPage, {files: files});
|
|
387
|
+
res.render(dirListingPage, { files: files });
|
|
388
388
|
});
|
|
389
389
|
} else {
|
|
390
390
|
res.sendFile(filePath);
|
package/lib/utils/reporter.js
CHANGED
package/package.json
CHANGED
package/testem.js
CHANGED
|
@@ -35,6 +35,8 @@ program
|
|
|
35
35
|
.option('-P, --parallel [num]', 'number of browsers to run in parallel, defaults to 1', Number)
|
|
36
36
|
.option('-b, --bail_on_uncaught_error', 'Bail on any uncaught errors')
|
|
37
37
|
.option('-R, --reporter [reporter]', 'Test reporter to use [tap|dot|xunit|teamcity]')
|
|
38
|
+
.option('--cwd [path]', 'directory to use as root')
|
|
39
|
+
.option('--config_dir [path]', 'directory to use as root for resolving configs, if different than cwd')
|
|
38
40
|
.action(act(env => {
|
|
39
41
|
env.__proto__ = program;
|
|
40
42
|
progOptions = env;
|