tape-six 0.10.0 → 0.12.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,8 @@ 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.12.0 *Removed data to avoid serializing non-serializable objects.*
36
+ * 0.11.0 *Minor improvements to the server: temporary redirects, a hyperlink to the web app.*
35
37
  * 0.10.0 *Refactored test runners, refactored stopping tests on failure, added JSONL reporter, fixed bugs.*
36
38
  * 0.9.6 *Updated deps.*
37
39
  * 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.12.0",
4
4
  "description": "TAP the test harness for the modern JavaScript (ES6).",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -21,9 +21,9 @@
21
21
  "build": "npm run copyDeep6",
22
22
  "prepublishOnly": "npm run build",
23
23
  "test": "node ./bin/tape6.js --flags FO",
24
- "test-bun": "bun run ./bin/tape6-bun.js --flags FO",
25
- "test-deno": "deno run -A ./bin/tape6-deno.js --flags FO",
26
- "test-chrome": "node tests/puppeteer-chrome.js"
24
+ "test:bun": "bun run ./bin/tape6-bun.js --flags FO",
25
+ "test:deno": "deno run -A ./bin/tape6-deno.js --flags FO",
26
+ "test:chrome": "node tests/puppeteer-chrome.js"
27
27
  },
28
28
  "github": "http://github.com/uhop/tape-six",
29
29
  "repository": {
package/src/State.js CHANGED
@@ -113,12 +113,14 @@ class State {
113
113
  }
114
114
 
115
115
  if (event.type === 'assert' && event.data) {
116
- typeof event.expected != 'string' &&
117
- event.data.hasOwnProperty('expected') &&
118
- (event.expected = serialize(event.data.expected));
119
- typeof event.actual != 'string' &&
120
- event.data.hasOwnProperty('actual') &&
121
- (event.actual = serialize(event.data.actual));
116
+ if (typeof event.expected != 'string' && event.data.hasOwnProperty('expected')) {
117
+ event.expected = serialize(event.data.expected);
118
+ }
119
+ if (typeof event.expected == 'string') delete event.data.expected;
120
+ if (typeof event.actual != 'string' && event.data.hasOwnProperty('actual')) {
121
+ event.actual = serialize(event.data.actual);
122
+ }
123
+ if (typeof event.actual == 'string') delete event.data.actual;
122
124
  }
123
125
 
124
126
  switch (event.type) {
@@ -142,7 +144,8 @@ class State {
142
144
 
143
145
  switch (event.type) {
144
146
  case 'assert':
145
- if (event.stopTest && event.operator !== 'exception') throw new StopTest('failOnce is activated');
147
+ if (event.stopTest && event.operator !== 'exception')
148
+ throw new StopTest('failOnce is activated');
146
149
  this.time = this.timer.now();
147
150
  break;
148
151
  case 'bail-out':