Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions test/FileSystemBlobStore-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -14,15 +15,13 @@ temp.track();
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 => {
Expand Down Expand Up @@ -62,7 +61,7 @@ tap.test('persists buffers when saved and retrieves them on load, giving priorit
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 => {
Expand Down
6 changes: 2 additions & 4 deletions test/NativeCompileCache-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,16 @@ let cachedFiles;
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 => {
Expand Down
8 changes: 4 additions & 4 deletions test/getCacheDir-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ tap.test('getCacheDir (v8)', t => {
t.match(nameParts[1], /^v8-compile-cache(-\d+)?$/);
t.equal(nameParts[2], process.versions.v8);

t.done();
t.end();
});

tap.test('getCacheDir (chakracore)', t => {
Expand All @@ -39,7 +39,7 @@ tap.test('getCacheDir (chakracore)', t => {
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 => {
Expand All @@ -62,7 +62,7 @@ tap.test('getCacheDir (unknown)', t => {
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 => {
Expand All @@ -83,5 +83,5 @@ tap.test('getCacheDir (env)', t => {

t.equal(cacheDir, 'from env');

t.done();
t.end();
});
3 changes: 1 addition & 2 deletions test/getMainName-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
3 changes: 1 addition & 2 deletions test/module-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ const child_process = require('child_process');
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 => {
Expand Down
2 changes: 1 addition & 1 deletion test/slashEscape-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ tap.test('escape', t => {
escapes[key]
);
}
t.done();
t.end();
});