testem 3.15.1 → 3.16.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 +10 -4
- package/lib/runners/browser_test_runner.js +8 -0
- package/lib/server/index.js +5 -5
- package/lib/utils/reporter.js +8 -0
- package/package.json +3 -3
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) {
|
|
@@ -325,7 +325,13 @@ class Config {
|
|
|
325
325
|
if (this.appMode === 'dev' || this.get('ignore_missing_launchers')) {
|
|
326
326
|
log.warn('Launcher "' + name + '" is not recognized.');
|
|
327
327
|
} else {
|
|
328
|
-
err = new Error(
|
|
328
|
+
err = new Error(
|
|
329
|
+
'Launcher ' +
|
|
330
|
+
name +
|
|
331
|
+
' not found. Not installed? Available: ' +
|
|
332
|
+
Object.keys(available).map(elm => `"${elm}"`).join(', ') +
|
|
333
|
+
'.'
|
|
334
|
+
);
|
|
329
335
|
}
|
|
330
336
|
} else {
|
|
331
337
|
launchers.push(launcher);
|
|
@@ -400,12 +406,12 @@ class Config {
|
|
|
400
406
|
if (patternUrl.protocol === 'file:') {
|
|
401
407
|
pattern = patternUrl.hostname + patternUrl.path;
|
|
402
408
|
} else if (patternUrl.protocol) {
|
|
403
|
-
return allThatIWant.concat({src: pattern, attrs: attrs});
|
|
409
|
+
return allThatIWant.concat({ src: pattern, attrs: attrs });
|
|
404
410
|
}
|
|
405
411
|
|
|
406
412
|
return globAsync(this.resolvePath(pattern), { ignore: dontWant }).then(files => allThatIWant.concat(files.map(f => {
|
|
407
413
|
f = this.reverseResolvePath(f);
|
|
408
|
-
return {src: f, attrs: attrs};
|
|
414
|
+
return { src: f, attrs: attrs };
|
|
409
415
|
})));
|
|
410
416
|
}, [])
|
|
411
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
|
@@ -136,10 +136,10 @@ class Server extends EventEmitter {
|
|
|
136
136
|
|
|
137
137
|
this.injectMiddleware(app);
|
|
138
138
|
|
|
139
|
-
this.configureProxy(app);
|
|
140
|
-
|
|
141
139
|
app.use('/testem', express.static(`${__dirname}/../../public/testem`));
|
|
142
140
|
|
|
141
|
+
this.configureProxy(app);
|
|
142
|
+
|
|
143
143
|
app.get('/', (req, res) => {
|
|
144
144
|
res.redirect(`/${String(Math.floor(Math.random() * 10000))}`);
|
|
145
145
|
});
|
|
@@ -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
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"unittest",
|
|
8
8
|
"browser"
|
|
9
9
|
],
|
|
10
|
-
"version": "3.
|
|
10
|
+
"version": "3.16.0",
|
|
11
11
|
"author": "Toby Ho <airportyh@gmail.com>",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"chai": "^4.0.2",
|
|
71
71
|
"chai-files": "^1.2.0",
|
|
72
72
|
"chai-shallow-deep-equal": "^1.4.4",
|
|
73
|
-
"cheerio": "
|
|
73
|
+
"cheerio": "1.0.0-rc.12",
|
|
74
74
|
"dirty-chai": "^2.0.0",
|
|
75
75
|
"eslint": "^8.12.0",
|
|
76
76
|
"eslint-plugin-chai-expect": "^3.0.0",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"request": "^2.51.0",
|
|
80
80
|
"saucie": "^3.3.3",
|
|
81
81
|
"shelljs": "^0.8.2",
|
|
82
|
-
"sinon": "
|
|
82
|
+
"sinon": "10.0.0",
|
|
83
83
|
"sinon-chai": "^3.2.0",
|
|
84
84
|
"socket.io-client": "^4.1.2",
|
|
85
85
|
"tape": "^5.2.2"
|