tape-six 0.10.0 → 0.11.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/README.md CHANGED
@@ -32,6 +32,7 @@ If you are familiar with other TAP-based libraries you'll feel right at home.
32
32
 
33
33
  The most recent releases:
34
34
 
35
+ * 0.11.0 *Minor improvements to the server: temporary redirects, a hyperlink to the web app.*
35
36
  * 0.10.0 *Refactored test runners, refactored stopping tests on failure, added JSONL reporter, fixed bugs.*
36
37
  * 0.9.6 *Updated deps.*
37
38
  * 0.9.5 *Updated the lock file.*
@@ -67,7 +67,7 @@ if (!webAppPath) {
67
67
  const mimeAliases = {mjs: 'js', cjs: 'js', htm: 'html', jpeg: 'jpg'};
68
68
  Object.keys(mimeAliases).forEach(name => (mimeTable[name] = mimeTable[mimeAliases[name]]));
69
69
 
70
- // colors to use
70
+ // escape codes to use
71
71
  const join = (...args) => args.map(value => value || '').join(''),
72
72
  paint = hasColors
73
73
  ? (prefix, suffix = '\x1B[39m') =>
@@ -80,6 +80,8 @@ const join = (...args) => args.map(value => value || '').join(''),
80
80
  yellow = paint('\x1B[93m'),
81
81
  blue = paint('\x1B[44;97m', '\x1B[49;39m');
82
82
 
83
+ const link = (url, text = url) => paint('\x1B]8;;' + url + '\x1B\\', '\x1B]8;;\x1B\\')(text);
84
+
83
85
  // sending helpers
84
86
 
85
87
  const sendFile = (req, res, fileName, ext, justHeaders) => {
@@ -109,7 +111,7 @@ const sendJson = (req, res, json, justHeaders) => {
109
111
  traceCalls && console.log(green('200') + ' ' + grey(req.method) + ' ' + grey(req.url));
110
112
  };
111
113
 
112
- const sendRedirect = (req, res, to, code = 301) => {
114
+ const sendRedirect = (req, res, to, code = 307) => {
113
115
  res.writeHead(code, {Location: to});
114
116
  res.end();
115
117
  traceCalls && console.log(blue(code) + ' ' + grey(req.method) + ' ' + grey(req.url));
@@ -223,7 +225,12 @@ server.on('listening', () => {
223
225
  grey(' at ') +
224
226
  yellow(bind) +
225
227
  grey(', serving static files from ') +
226
- yellow(rootFolder) +
227
- '\n'
228
+ yellow(rootFolder)
228
229
  );
230
+ if (host && bind) {
231
+ console.log(
232
+ grey('Open ') + link('http://' + host + ':' + port + '/') + grey(' in your browser')
233
+ );
234
+ }
235
+ console.log();
229
236
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tape-six",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "TAP the test harness for the modern JavaScript (ES6).",
5
5
  "type": "module",
6
6
  "main": "index.js",