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
|
Subject: port to latest tap (t.done -> t.end)
Author: Jérémy Lal <kapouer@melix.org>
Last-Update: 2022-04-30
Forwarded: https://github.com/zertosh/v8-compile-cache/pull/42
--- a/test/FileSystemBlobStore-test.js
+++ b/test/FileSystemBlobStore-test.js
@@ -2,7 +2,8 @@
const fs = require('fs');
const path = require('path');
-const rimraf = require('rimraf');
+const { promisify } = require('util');
+const rimraf = promisify(require('rimraf'));
const tap = require('tap');
const temp = require('temp');
@@ -14,15 +15,13 @@
let storageDirectory;
let blobStore;
-tap.beforeEach(cb => {
+tap.beforeEach(() => {
storageDirectory = temp.path('filesystemblobstore');
blobStore = new FileSystemBlobStore(storageDirectory);
- cb();
});
-tap.afterEach(cb => {
- rimraf.sync(storageDirectory);
- cb();
+tap.afterEach(() => {
+ return rimraf(storageDirectory);
});
tap.test('is empty when the file doesn\'t exist', t => {
@@ -62,7 +61,7 @@
t.same(blobStore.get('foo', 'new-key'), Buffer.from('changed'));
t.type(blobStore.get('foo', 'invalidation-key-1'), 'undefined');
- t.done();
+ t.end();
});
tap.test('persists both in-memory and previously stored buffers when saved', t => {
--- a/test/getCacheDir-test.js
+++ b/test/getCacheDir-test.js
@@ -16,7 +16,7 @@
t.match(nameParts[1], /^v8-compile-cache(-\d+)?$/);
t.equal(nameParts[2], process.versions.v8);
- t.done();
+ t.end();
});
tap.test('getCacheDir (chakracore)', t => {
@@ -39,7 +39,7 @@
t.match(nameParts[1], /^v8-compile-cache(-\d+)?$/);
t.equal(nameParts[2], 'chakracore-1.2.3');
- t.done();
+ t.end();
});
tap.test('getCacheDir (unknown)', t => {
@@ -62,7 +62,7 @@
t.match(nameParts[1], /^v8-compile-cache(-\d+)?$/);
t.equal(nameParts[2], 'node-1.2.3');
- t.done();
+ t.end();
});
tap.test('getCacheDir (env)', t => {
@@ -83,5 +83,5 @@
t.equal(cacheDir, 'from env');
- t.done();
+ t.end();
});
--- a/test/slashEscape-test.js
+++ b/test/slashEscape-test.js
@@ -19,5 +19,5 @@
escapes[key]
);
}
- t.done();
+ t.end();
});
--- a/test/NativeCompileCache-test.js
+++ b/test/NativeCompileCache-test.js
@@ -17,18 +17,16 @@
let fakeCacheStore;
let nativeCompileCache;
-tap.beforeEach(cb => {
+tap.beforeEach(() => {
fakeCacheStore = new FileSystemBlobStore_mock();
cachedFiles = fakeCacheStore._cachedFiles;
nativeCompileCache = new NativeCompileCache();
nativeCompileCache.setCacheStore(fakeCacheStore);
nativeCompileCache.install();
- cb();
});
-tap.afterEach(cb => {
+tap.afterEach(() => {
nativeCompileCache.uninstall();
- cb();
});
tap.test('writes and reads from the cache storage when requiring files', t => {
--- a/test/getMainName-test.js
+++ b/test/getMainName-test.js
@@ -3,9 +3,8 @@
const tap = require('tap');
const child_process = require('child_process');
-tap.beforeEach(cb => {
+tap.beforeEach(() => {
delete process.env.DISABLE_V8_COMPILE_CACHE;
- cb();
});
tap.test('handles --require', t => {
--- a/test/module-test.js
+++ b/test/module-test.js
@@ -4,9 +4,8 @@
const tap = require('tap');
const semver = require('semver');
-tap.beforeEach(cb => {
+tap.beforeEach(() => {
delete process.env.DISABLE_V8_COMPILE_CACHE;
- cb();
});
tap.test('require.resolve.paths module', t => {
|