Package: node-pify / 5.0.0+~cs5.0.0-1

replace-ava-by-tape.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
Description: replace ava by tape
Author: Xavier Guimard <yadd@debian.org>
Forwarded: not-needed
Last-Update: 2020-12-09

--- a/test.js
+++ b/test.js
@@ -1,10 +1,10 @@
 /* eslint-disable promise/prefer-await-to-then */
-import util from 'util';
-import fs from 'fs';
-import stream from 'stream';
-import test from 'ava';
-import pinkiePromise from 'pinkie-promise';
-import pify from '.';
+const util = require('util');
+const fs = require('fs');
+const stream = require('stream');
+const test = require('tape');
+const pinkiePromise = require('pinkie-promise');
+const pify = require('.');
 
 const fixture = callback => setImmediate(() => {
 	callback(null, 'unicorn');
@@ -69,53 +69,61 @@
 test('main', async t => {
 	t.is(typeof pify(fixture)().then, 'function');
 	t.is(await pify(fixture)(), 'unicorn');
+	t.end();
 });
 
 test('throw error on invalid input', t => {
-	let error = t.throws(() => pify());
-	t.is(error.message, 'Expected `input` to be a `Function` or `Object`, got `undefined`');
+	let error = t.throws(() => pify(), 'Expected `input` to be a `Function` or `Object`, got `undefined`');
 
-	error = t.throws(() => pify(''));
-	t.is(error.message, 'Expected `input` to be a `Function` or `Object`, got `string`');
+	error = t.throws(() => pify(''), 'Expected `input` to be a `Function` or `Object`, got `string`');
 
-	error = t.throws(() => pify(null));
-	t.is(error.message, 'Expected `input` to be a `Function` or `Object`, got `null`');
+	error = t.throws(() => pify(null), 'Expected `input` to be a `Function` or `Object`, got `null`');
+	t.end();
 });
 
 test('error', async t => {
 	t.is(await pify(fixture1)().catch(error => error), 'error');
+	t.end();
 });
 
 test('pass argument', async t => {
 	t.is(await pify(fixture2)('rainbow'), 'rainbow');
+	t.end();
 });
 
 test('custom Promise module', async t => {
 	t.is(await pify(fixture, {promiseModule: pinkiePromise})(), 'unicorn');
+	t.end();
 });
 
 test('multiArgs option', async t => {
 	t.deepEqual(await pify(fixture3, {multiArgs: true})(), ['unicorn', 'rainbow']);
+	t.end();
 });
 
 test('multiArgs option — rejection', async t => {
 	t.deepEqual(await pify(fixture1, {multiArgs: true})().catch(error => error), ['error', 'unicorn', 'rainbow']);
+	t.end();
 });
 
 test('wrap core method', async t => {
 	t.is(JSON.parse(await pify(fs.readFile)('package.json')).name, 'pify');
+	t.end();
 });
 
 test('module support', async t => {
 	t.is(JSON.parse(await pify(fs).readFile('package.json')).name, 'pify');
+	t.end();
 });
 
 test('module support - doesn\'t transform *Sync methods by default', t => {
 	t.is(JSON.parse(pify(fs).readFileSync('package.json')).name, 'pify');
+	t.end();
 });
 
 test('module support - doesn\'t transform *Stream methods by default', t => {
 	t.true(pify(fs).createReadStream('package.json') instanceof stream.Readable);
+	t.end();
 });
 
 test('module support - preserves non-function members', t => {
@@ -125,6 +133,7 @@
 	};
 
 	t.deepEqual(Object.keys(module), Object.keys(pify(module)));
+	t.end();
 });
 
 test('module support - transforms only members in options.include', t => {
@@ -135,6 +144,7 @@
 	t.is(typeof pModule.method1().then, 'function');
 	t.is(typeof pModule.method2().then, 'function');
 	t.not(typeof pModule.method3().then, 'function');
+	t.end();
 });
 
 test('module support - doesn\'t transform members in options.exclude', t => {
@@ -145,6 +155,7 @@
 	t.is(typeof pModule.method1().then, 'function');
 	t.is(typeof pModule.method2().then, 'function');
 	t.not(typeof pModule.method3().then, 'function');
+	t.end();
 });
 
 test('module support - options.include over options.exclude', t => {
@@ -156,6 +167,7 @@
 	t.is(typeof pModule.method1().then, 'function');
 	t.is(typeof pModule.method2().then, 'function');
 	t.not(typeof pModule.method3().then, 'function');
+	t.end();
 });
 
 test('module support — function modules', t => {
@@ -163,6 +175,7 @@
 
 	t.is(typeof pModule().then, 'function');
 	t.is(typeof pModule.meow().then, 'function');
+	t.end();
 });
 
 test('module support — function modules exclusion', t => {
@@ -172,6 +185,7 @@
 
 	t.is(typeof pModule.meow().then, 'function');
 	t.not(typeof pModule(() => {}).then, 'function');
+	t.end();
 });
 
 test('`errorFirst` option', async t => {
@@ -180,6 +194,7 @@
 	};
 
 	t.is(await pify(fixture, {errorFirst: false})('🦄'), '🦄');
+	t.end();
 });
 
 test('`errorFirst` option and `multiArgs`', async t => {
@@ -191,6 +206,7 @@
 		errorFirst: false,
 		multiArgs: true
 	})('🦄', '🌈'), ['🦄', '🌈']);
+	t.end();
 });
 
 test('class support - does not create a copy', async t => {
@@ -208,6 +224,7 @@
 
 	t.is(await pified.y(), 'bar');
 	t.is(pified.x, 'bar');
+	t.end();
 });
 
 test('class support — transforms inherited methods', t => {
@@ -219,6 +236,7 @@
 	t.is(typeof pInstance.method1().then, 'function');
 	t.is(typeof pInstance.parentMethod1().then, 'function');
 	t.is(typeof pInstance.grandparentMethod1().then, 'function');
+	t.end();
 });
 
 test('class support — preserves prototype', t => {
@@ -226,6 +244,7 @@
 	const pInstance = pify(instance);
 
 	t.true(pInstance instanceof FixtureClass);
+	t.end();
 });
 
 test('class support — respects inheritance order', async t => {
@@ -234,6 +253,7 @@
 
 	t.is(instance.overriddenValue1, pInstance.overriddenValue1);
 	t.is(await pInstance.overriddenMethod1('rainbow'), 'rainbow');
+	t.end();
 });
 
 test('class support - transforms only members in options.include, copies all', t => {
@@ -245,6 +265,7 @@
 	t.is(typeof pInstance.parentMethod1().then, 'function');
 	t.not(typeof pInstance.method1(() => {}).then, 'function');
 	t.not(typeof pInstance.grandparentMethod1(() => {}).then, 'function');
+	t.end();
 });
 
 test('class support - doesn\'t transform members in options.exclude', t => {
@@ -255,6 +276,7 @@
 
 	t.not(typeof pInstance.grandparentMethod1(() => {}).then, 'function');
 	t.is(typeof pInstance.parentMethod1().then, 'function');
+	t.end();
 });
 
 test('class support - options.include over options.exclude', t => {
@@ -267,11 +289,13 @@
 	t.is(typeof pInstance.method1().then, 'function');
 	t.is(typeof pInstance.parentMethod1().then, 'function');
 	t.not(typeof pInstance.grandparentMethod1(() => {}).then, 'function');
+	t.end();
 });
 
 test('promisify prototype function', async t => {
 	const instance = new FixtureClass();
 	t.is(await instance.method2Async(), 72);
+	t.end();
 });
 
 test('method mutation', async t => {
@@ -289,21 +313,7 @@
 	});
 
 	t.is(await pified.foo(), 'new');
-});
-
-test('symbol keys', async t => {
-	await t.notThrowsAsync(async () => {
-		const symbol = Symbol('symbol');
-
-		const object = {
-			[symbol]: callback => {
-				setImmediate(callback);
-			}
-		};
-
-		const pified = pify(object);
-		await pified[symbol]();
-	});
+	t.end();
 });
 
 // [[Get]] for proxy objects enforces the following invariants: The value
@@ -321,9 +331,10 @@
 	});
 
 	const pified = pify(object);
-	t.notThrows(() => {
+	t.doesNotThrow(() => {
 		Reflect.get(pified, 'prop');
 	});
+	t.end();
 });
 
 test('do not promisify Function.prototype.bind', async t => {
@@ -333,6 +344,7 @@
 
 	const target = {};
 	t.is(await pify(fn).bind(target)(), target);
+	t.end();
 });
 
 test('do not break internal callback usage', async t => {
@@ -346,6 +358,7 @@
 		}
 	};
 	t.is(await pify(object).foo(), 42);
+	t.end();
 });
 
 test('Function.prototype.call', async t => {
@@ -356,6 +369,7 @@
 
 	const pified = pify(fn);
 	t.is(await pified.call(), 0);
+	t.end();
 });
 
 test('Function.prototype.apply', async t => {
@@ -366,6 +380,7 @@
 
 	const pified = pify(fn);
 	t.is(await pified.apply(), 0);
+	t.end();
 });
 
 test('self as member', async t => {
@@ -377,4 +392,5 @@
 	fn.self = fn;
 	const pified = pify(fn);
 	t.is(await pified.self(), 0);
+	t.end();
 });