dns2 2.0.0 → 2.0.3

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/test/test.js CHANGED
@@ -1,27 +1,34 @@
1
- const { inspect } = require('util');
2
- /**
3
- * super tiny testing framework
4
- *
5
- * @author Liu song <hi@lsong.org>
6
- * @github https://github.com/song940
7
- */
8
- const test = async (title, fn) => {
9
- try {
10
- await fn();
11
- console.log(color(` ✔ ${title}`, 32));
12
- } catch (err) {
13
- console.error(color(` ✘ ${title}`, 31));
14
- console.log();
15
- console.log(color(` ${err.name}: ${err.message}`, 31));
16
- console.error(color(` expected: ${inspect(err.expected)}`, 32));
17
- console.error(color(` actual: ${inspect(err.actual)}`, 31));
18
- console.log();
19
- process.exit(1);
20
- }
21
- };
22
-
23
- function color(str, c) {
24
- return "\x1b[" + c + "m" + str + "\x1b[0m";
25
- };
26
-
27
- module.exports = test;
1
+ const { inspect } = require('util');
2
+
3
+ let previous = Promise.resolve();
4
+
5
+ /**
6
+ * super tiny testing framework
7
+ *
8
+ * @author Liu song <hi@lsong.org>
9
+ * @github https://github.com/song940
10
+ */
11
+ const test = (title, fn) => {
12
+ previous = previous.then(async() => {
13
+ try {
14
+ await fn();
15
+ console.log(color(` ${title}`, 32));
16
+ } catch (err) {
17
+ console.error(color(` ${title}`, 31));
18
+ console.log();
19
+ console.log(color(` ${err.name}: ${err.message}`, 31));
20
+ console.error(color(` expected: ${inspect(err.expected)}`, 32));
21
+ console.error(color(` actual: ${inspect(err.actual)}`, 31));
22
+ console.log(err.stack);
23
+ console.log();
24
+ process.exit(1);
25
+ }
26
+ });
27
+ return previous;
28
+ };
29
+
30
+ function color(str, c) {
31
+ return `\x1b[${c}m${str}\x1b[0m`;
32
+ }
33
+
34
+ module.exports = test;
package/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - "stable"
4
- - "v8.13.0"