|
1 | 1 | 'use strict' |
2 | 2 |
|
3 | | -const { test, skip } = require('node:test') |
| 3 | +const { test } = require('node:test') |
4 | 4 | const { notEqual, strictEqual, deepStrictEqual } = require('node:assert') |
5 | 5 | const { rm } = require('node:fs/promises') |
6 | 6 | const { cacheStoreTests, writeBody, compareGetResults } = require('./cache-store-test-utils.js') |
7 | 7 |
|
8 | 8 | let hasSqlite = false |
9 | 9 | try { |
10 | 10 | require('node:sqlite') |
11 | | - |
12 | | - const SqliteCacheStore = require('../../lib/cache/sqlite-cache-store.js') |
13 | | - cacheStoreTests(SqliteCacheStore) |
14 | 11 | hasSqlite = true |
15 | 12 | } catch (err) { |
16 | | - if (err.code === 'ERR_UNKNOWN_BUILTIN_MODULE') { |
17 | | - skip('`node:sqlite` not present') |
18 | | - } else { |
| 13 | + if (err.code !== 'ERR_UNKNOWN_BUILTIN_MODULE') { |
19 | 14 | throw err |
20 | 15 | } |
21 | 16 | } |
22 | 17 |
|
23 | | -test('SqliteCacheStore works nicely with multiple stores', async (t) => { |
24 | | - if (!hasSqlite) { |
25 | | - t.skip() |
26 | | - return |
27 | | - } |
| 18 | +const SqliteCacheStore = require('../../lib/cache/sqlite-cache-store.js') |
| 19 | +cacheStoreTests(SqliteCacheStore, { skip: !hasSqlite }) |
28 | 20 |
|
| 21 | +test('SqliteCacheStore works nicely with multiple stores', { skip: !hasSqlite }, async (t) => { |
29 | 22 | const SqliteCacheStore = require('../../lib/cache/sqlite-cache-store.js') |
30 | 23 | const sqliteLocation = 'cache-interceptor.sqlite' |
31 | 24 |
|
@@ -88,12 +81,7 @@ test('SqliteCacheStore works nicely with multiple stores', async (t) => { |
88 | 81 | } |
89 | 82 | }) |
90 | 83 |
|
91 | | -test('SqliteCacheStore maxEntries', async (t) => { |
92 | | - if (!hasSqlite) { |
93 | | - t.skip() |
94 | | - return |
95 | | - } |
96 | | - |
| 84 | +test('SqliteCacheStore maxEntries', { skip: !hasSqlite }, async () => { |
97 | 85 | const SqliteCacheStore = require('../../lib/cache/sqlite-cache-store.js') |
98 | 86 |
|
99 | 87 | const store = new SqliteCacheStore({ |
@@ -133,12 +121,7 @@ test('SqliteCacheStore maxEntries', async (t) => { |
133 | 121 | strictEqual(store.size <= 11, true) |
134 | 122 | }) |
135 | 123 |
|
136 | | -test('SqliteCacheStore two writes', async (t) => { |
137 | | - if (!hasSqlite) { |
138 | | - t.skip() |
139 | | - return |
140 | | - } |
141 | | - |
| 124 | +test('SqliteCacheStore two writes', { skip: !hasSqlite }, async () => { |
142 | 125 | const SqliteCacheStore = require('../../lib/cache/sqlite-cache-store.js') |
143 | 126 |
|
144 | 127 | const store = new SqliteCacheStore({ |
@@ -182,12 +165,7 @@ test('SqliteCacheStore two writes', async (t) => { |
182 | 165 | } |
183 | 166 | }) |
184 | 167 |
|
185 | | -test('SqliteCacheStore write & read', async (t) => { |
186 | | - if (!hasSqlite) { |
187 | | - t.skip() |
188 | | - return |
189 | | - } |
190 | | - |
| 168 | +test('SqliteCacheStore write & read', { skip: !hasSqlite }, async () => { |
191 | 169 | const SqliteCacheStore = require('../../lib/cache/sqlite-cache-store.js') |
192 | 170 |
|
193 | 171 | const store = new SqliteCacheStore({ |
|
0 commit comments