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
|
Description: fix this test to pass on nodejs 18.13 and 18.19
Author: Jérémy Lal <kapouer@melix.org>
Last-Update: 2023-12-12
Forwarded: https://github.com/zertosh/v8-compile-cache/pull/49
--- a/test/NativeCompileCache-test.js
+++ b/test/NativeCompileCache-test.js
@@ -82,17 +82,19 @@
t.end();
});
-tap.test('replaces previously cached code when the cache is an invalid file', t => {
+tap.test('replaces or deletes previously cached code when the cache is an invalid file', t => {
fakeCacheStore.has = () => true;
fakeCacheStore.get = () => Buffer.from('an invalid cache');
// NOTE: When `script.cachedDataProduced` is true, `_cacheStore` is updated
// using `set` instead of `delete`.
- let setWasCalledWith = null;
- fakeCacheStore.set = arg => { setWasCalledWith = arg; };
+ let wasCalledWith = null;
+ fakeCacheStore.set = arg => { wasCalledWith = arg; };
+ // older v8 still calls delete, though
+ fakeCacheStore.delete = arg => { wasCalledWith = arg; };
const fn3 = require('./fixtures/file-3');
- t.equal(setWasCalledWith, require.resolve('./fixtures/file-3'));
+ t.equal(wasCalledWith, require.resolve('./fixtures/file-3'));
t.equal(fn3(), 3);
t.end();
|