Open History to see the last commit
1import { describe, it } from 'vitest'
2import assert from 'node:assert/strict'
3import { spawnSync } from 'node:child_process'
4import { join } from 'node:path'
5import { fileURLToPath } from 'node:url'
6import { RuleTester } from 'eslint'
7import tsParser from '@typescript-eslint/parser'
8import noDisabled from './rules/no-disabled.js'
9
10RuleTester.describe = describe
11RuleTester.it = it
12
13const ruleTester = new RuleTester({
14 languageOptions: { parser: tsParser },
15})
16
17it(`permits selecting only the replay observation checker controls`, () => {
18 const root = fileURLToPath(new URL('../../', import.meta.url))
19 const result = spawnSync(
20 process.execPath,
21 [
22 join(root, 'node_modules/vitest/vitest.mjs'),
23 'run',
24 '--config',
25 'scripts/eslint-plugin-oracle/vitest.config.mjs',
26 'scripts/eslint-plugin-oracle/replay-observation-oracle.test.js',
27 '-t',
28 'rejects wrong report observation',
29 '--reporter=json',
30 ],
31 {
32 cwd: root,
33 encoding: 'utf8',
34 timeout: 10_000,
35 maxBuffer: 16 * 1024 * 1024,
36 },
37 )
38 assert.equal(result.error, undefined)
39 assert.equal(result.status, 0, result.stdout + result.stderr)
40 const report = JSON.parse(result.stdout)
41 assert.equal(report.numPassedTests, 2)
42 assert.equal(report.numFailedTests, 0)
43 assert.equal(report.numPendingTests, 3848)
44})
45
46ruleTester.run(`oracle/no-disabled`, noDisabled, {
47 valid: [
48 // A selection helper's result used as a registration, with no modifier.
49 {
50 code: `import { oracleReplayTest } from './oracle-config.js'\nimport { it as vitestIt } from 'vitest'\nconst fixedCase = oracleReplayTest(vitestIt)\nfixedCase('checks the fixed history', () => check(history))`,
51 languageOptions: { sourceType: `module` },
52 },
53 // A constant that is not bound to a test function registers nothing.
54 {
55 code: `const helper = makeHelper()\nhelper.skip('a', () => check())`,
56 languageOptions: { sourceType: `module` },
57 },
58 // The shared replay variables, and variables that select no replay.
59 `const seed = process.env.TANSTACK_DB_ORACLE_SEED`,
60 `const { TANSTACK_DB_ORACLE_PATH, TANSTACK_DB_ORACLE_PROPERTY } = process.env`,
61 `const statistics = process.env.TANSTACK_DB_ORACLE_STATISTICS`,
62 `const debug = process.env.RELOAD_ORACLE_DEBUG`,
63 `const seed = config.TANSTACK_DB_LIKE_ORACLE_SEED`,
64 // oracle-config implements replay selection, so it reads every variable.
65 {
66 code: `const seed = process.env.UTILS_ORACLE_SEED`,
67 filename: `/repo/packages/db/tests/oracle-config.ts`,
68 },
69 // A replay that does not select this property registers an empty test.
70 `it.skip('runs only when its replay property is selected', () => {})`,
71 `it.todo('loads every subset from one generation')`,
72 // Playwright's runtime skip for a control that one browser supports.
73 `test.skip(browserName !== 'chromium', 'Chromium-only control')`,
74 // A replay campaign stands the other tests aside.
75 {
76 code: `import { oracleReplayRequested } from '../../db/tests/oracle-config.js'\nit.skipIf(oracleReplayRequested())('checks the history', () => check())`,
77 languageOptions: { sourceType: `module` },
78 },
79 {
80 code: `import { oracleReplayRequested } from './oracle-config'\nit.skipIf(oracleReplayRequested())('checks the history', () => check())`,
81 languageOptions: { sourceType: `module` },
82 },
83 `fc.assert(property, oraclePropertyOptions(12, 'cleanup-queue.history'))`,
84 `fc.assert(property, { numRuns: oracleRuns(20) })`,
85 `const BINDING_RUNS = 12\nfc.assert(property, { numRuns: oracleRuns(BINDING_RUNS) })`,
86 `const fixedSeed = 7\nconst runs = 30\nfc.assert(property, { seed: fixedSeed, numRuns: runs })`,
87 // A replay passes the recorded path, and a witness a fixed seed.
88 `fc.check(property, { seed: failed.seed, path: failed.counterexamplePath, numRuns: 1 })`,
89 `fc.check(property, { seed: 205203, numRuns: 1 })`,
90 `fc.check(property, { seed: -1659005, numRuns: 1 })`,
91 `const fixedSeed = 1657019\nfc.check(property, { seed: fixedSeed, numRuns: 1 })`,
92 `fc.assert(property, { seed: 2128, numRuns: oracleRuns(1) })`,
93 // An expectation about a recorded run is not a run option, and a sample
94 // runs no property.
95 `expect(report).toMatchObject({ numRuns: 1, failed: true })`,
96 `fc.sample(historyArbitrary, { numRuns: 1 })`,
97 {
98 code: `const witness: OracleReplayWitness = { numRuns: 1 }; appendFileSync(channel, JSON.stringify(witness))`,
99 filename: `/repo/packages/db/tests/oracle-replay-witness.ts`,
100 },
101 {
102 code: `const witness: OracleReplayWitness = { numRuns: 1 }; type Snapshot = typeof witness; appendFileSync(channel, JSON.stringify(witness)); type Count = typeof witness.numRuns`,
103 filename: `/repo/packages/db/tests/oracle-replay-witness.ts`,
104 },
105 {
106 code: `type JSON = { marker: true }; const witness: OracleReplayWitness = { numRuns: 1 }; JSON.stringify(witness)`,
107 filename: `/repo/packages/db/tests/oracle-replay-witness.ts`,
108 },
109 // A known gap is pinned as failing on a fixed seed, not skipped.
110 `it.fails('checks the fixed history', () => fc.assert(property, { seed: 2128, numRuns: oracleRuns(12) }))`,
111 // The shared replay helpers may select a replay, in either polarity for
112 // a registration and through the alias helper.
113 ...[
114 `it.skipIf(oracleReplaySkips('cursor.exact-width'))('a', () => check())`,
115 `if (!oracleReplayRequested()) { it('a', () => check()) }`,
116 `if (oracleReplayRequested()) { replayOnly() } else { it('a', () => check()) }`,
117 `const propertyTest = oracleReplayTest(fcTest, 'cursor.exact-width')\npropertyTest.prop([a])('a', check)`,
118 `describe('s', () => { if (oracleReplaySkips('cursor.exact-width')) return\n it('a', () => check()) })`,
119 ].map((code) => ({
120 code: `import { oracleReplayRequested, oracleReplaySkips, oracleReplayTest } from './oracle-config.js'\n${code}`,
121 languageOptions: { sourceType: `module` },
122 })),
123 // Playwright's test API calls that register nothing.
124 `test('a', async () => { if (rejected) { expect(test.info().project.name).not.toBe('webkit') } })`,
125 // A guard that skips a loop item filters data, as \`.filter\` would.
126 `for (const c of cases) { if (!c.legal) continue\n it(c.name, () => check(c)) }`,
127 // A loop over a table that a replay helper empties during a replay, and a
128 // data filter, run every item in ordinary runs.
129 ...[
130 `for (const c of oracleReplayRequested() ? [] : cases) { it(c.name, () => check(c)) }`,
131 `it.each(cases.filter((c) => c.legal))('%s', (c) => check(c))`,
132 `const campaigns = oracleReplaySkips('cursor.exact-width') ? [] : cases\nfor (const c of campaigns) { it(c.name, () => check(c)) }`,
133 `const registration = oracleReplayTest(it)\nregistration('a', () => check())`,
134 ].map((code) => ({
135 code: `import { oracleReplayRequested, oracleReplaySkips, oracleReplayTest } from './oracle-config.js'\n${code}`,
136 languageOptions: { sourceType: `module` },
137 })),
138 // Registrations in a loop or over a table run in every ordinary run.
139 `for (const campaign of campaigns) { it(campaign.name, () => check(campaign)) }`,
140 `const fixedRuns = { seed: 1846, numRuns: 40 }`,
141 // A skip on something other than the test context is not a test skip.
142 `it('reads a page', (ctx) => { const cursor = open(); cursor.skip() })`,
143 // An inner variable that shadows the context is not the test context.
144 `it('reads a page', (ctx) => { pages.forEach((ctx) => ctx.skip()) })`,
145 `it('reads a page', (_, ctx) => { ctx.skip() })`,
146 ],
147 invalid: [
148 ...[
149 `fc.assert(property, { numRuns: 1 })`,
150 `const witness: OracleReplayWitness = { numRuns: 1 }; appendFileSync(channel, JSON.stringify(witness)); fc.assert(property, witness)`,
151 `const witness: OracleReplayWitness = { numRuns: 1 }; const options = witness; fc.assert(property, options)`,
152 `export const witness: OracleReplayWitness = { numRuns: 1 }; JSON.stringify(witness)`,
153 `function outer(JSON) { { type JSON = { marker: true }; const witness: OracleReplayWitness = { numRuns: 1 }; JSON.stringify(witness) } }`,
154 `const budgetHook = { toJSON() { fc.assert(property, this); return null } }; const witness: OracleReplayWitness = { ...budgetHook, numRuns: 1 }; JSON.stringify(witness)`,
155 `const budgetHook = { toJSON() { fc.assert(property, this); return null } }; const witness: OracleReplayWitness = { __proto__: budgetHook, numRuns: 1 }; JSON.stringify(witness)`,
156 ].map((code) => ({
157 code,
158 filename: `/repo/packages/db/tests/oracle-replay-witness.ts`,
159 errors: [{ messageId: `singleRun` }],
160 })),
161 {
162 code: `const witness: OracleReplayWitness = { numRuns: 1 }; appendFileSync(channel, JSON.stringify(witness))`,
163 filename: `/repo/packages/db/tests/other-output.ts`,
164 errors: [{ messageId: `singleRun` }],
165 },
166 // A private variable that selects a replay or a run count.
167 {
168 code: `const seed = process.env.TANSTACK_DB_LIKE_ORACLE_SEED`,
169 errors: [
170 {
171 messageId: `replayVariable`,
172 data: { name: `TANSTACK_DB_LIKE_ORACLE_SEED` },
173 },
174 ],
175 },
176 {
177 code: `fc.assert(property, { path: process.env['BTREE_MAP_ORACLE_PATH'] })`,
178 errors: [{ messageId: `replayVariable` }],
179 },
180 {
181 code: `const runs = Number(process.env.TANSTACK_DB_OPFS_CLOSE_ORACLE_RUNS ?? 20)`,
182 errors: [{ messageId: `replayVariable` }],
183 },
184 {
185 code: `const { INDEXEDDB_ORACLE_SEED: seed, TANSTACK_DB_ORACLE_PATH } = process.env`,
186 errors: [
187 {
188 messageId: `replayVariable`,
189 data: { name: `INDEXEDDB_ORACLE_SEED` },
190 },
191 ],
192 },
193 {
194 code: `const property = process.env.UTILS_ORACLE_PROPERTY`,
195 filename: `/repo/packages/db/tests/utils-oracle.property.test.ts`,
196 errors: [{ messageId: `replayVariable` }],
197 },
198 {
199 code: `it.only('checks the history', () => {})`,
200 errors: [{ messageId: `only` }],
201 },
202 {
203 code: `describe.only('cleanup queue', () => { it('a', () => {}) })`,
204 errors: [{ messageId: `only` }],
205 },
206 {
207 code: `fcTest.only.prop([history])('checks the history', (h) => check(h))`,
208 errors: [{ messageId: `only` }],
209 },
210 {
211 code: `it.skip('checks random histories', () => fc.assert(property))`,
212 errors: [{ messageId: `skip`, data: { name: `skip` } }],
213 },
214 {
215 code: `describe.skip('cleanup queue', () => { it('a', () => check()) })`,
216 errors: [{ messageId: `skip` }],
217 },
218 {
219 code: `fcTest.skip.prop([history])('checks the history', (h) => check(h))`,
220 errors: [{ messageId: `skip` }],
221 },
222 {
223 code: `it.skip('checks follower histories', assertFollowerHistory)`,
224 errors: [{ messageId: `skip` }],
225 },
226 {
227 code: `fcTest.skip.prop([history])('checks the history', checkHistory)`,
228 errors: [{ messageId: `skip` }],
229 },
230 {
231 code: `test.skip()`,
232 errors: [{ messageId: `skip` }],
233 },
234 {
235 code: `test.skip(true, 'flaky in CI')`,
236 errors: [{ messageId: `skip` }],
237 },
238 {
239 code: `it.skipIf(true)('checks the history', () => check())`,
240 errors: [{ messageId: `conditional`, data: { name: `skipIf` } }],
241 },
242 {
243 code: `describe.runIf(false)('cleanup queue', () => { it('a', () => check()) })`,
244 errors: [{ messageId: `conditional`, data: { name: `runIf` } }],
245 },
246 {
247 code: `describe.skipIf(process.env.CI)('cleanup queue', () => { it('a', () => check()) })`,
248 errors: [{ messageId: `conditional` }],
249 },
250 {
251 code: `it.todo('checks the history', () => { check() })`,
252 errors: [{ messageId: `skip`, data: { name: `todo` } }],
253 },
254 {
255 code: `fc.assert(property, { numRuns: 1 })`,
256 errors: [{ messageId: `singleRun` }],
257 },
258 {
259 code: `fc.assert(property, { ...oraclePropertyOptions(100, 'p'), numRuns: 1 })`,
260 errors: [{ messageId: `singleRun` }],
261 },
262 {
263 code: `fc.assert(property, oraclePropertyOptions(1, 'cleanup-queue.history'))`,
264 errors: [{ messageId: `singleRun` }],
265 },
266 {
267 code: `fc.assert(property, { seed: Date.now(), numRuns: 1 })`,
268 errors: [{ messageId: `singleRun` }],
269 },
270 {
271 code: `fc.assert(property, { seed: undefined, numRuns: 1 })`,
272 errors: [{ messageId: `singleRun` }],
273 },
274 {
275 code: `fc.assert(property, filePath ? { numRuns: 1 } : {})`,
276 errors: [{ messageId: `singleRun` }],
277 },
278 {
279 code: `it.skipIf(useFilePath)('checks the history', () => check())`,
280 errors: [{ messageId: `conditional` }],
281 },
282 {
283 code: `fc.assert(property, { numRuns: oracleRuns(0) })`,
284 errors: [{ messageId: `singleRun` }],
285 },
286 {
287 code: `test.skip(isMobile)`,
288 errors: [{ messageId: `skip` }],
289 },
290 {
291 code: `test.skip(process.env.CI === 'true', 'flaky')`,
292 errors: [{ messageId: `skip` }],
293 },
294 {
295 code: `test.fixme('checks the history', check)`,
296 errors: [{ messageId: `skip`, data: { name: `fixme` } }],
297 },
298 {
299 code: `test.describe.fixme('cleanup queue', () => { test('a', check) })`,
300 errors: [{ messageId: `skip`, data: { name: `fixme` } }],
301 },
302 {
303 code: `test.fixme()`,
304 errors: [{ messageId: `skip`, data: { name: `fixme` } }],
305 },
306 {
307 code: `it('checks the history', (ctx) => { ctx.skip(); check() })`,
308 errors: [{ messageId: `skip` }],
309 },
310 {
311 code: `it('checks the history', (ctx) => { steps.forEach(() => ctx.skip()) })`,
312 errors: [{ messageId: `skip` }],
313 },
314 {
315 // A local function with the helper's name is not the shared helper.
316 code: `const oracleReplayRequested = () => process.env.CI === 'true'\nit.skipIf(oracleReplayRequested())('checks the history', () => check())`,
317 errors: [{ messageId: `conditional` }],
318 },
319 {
320 code: `it.skipIf(oracleReplayRequested())('checks the history', () => check())`,
321 errors: [{ messageId: `conditional` }],
322 },
323 {
324 // Only the shared helper may select a replay: its polarity is fixed.
325 code: `it.skipIf(replayRequested)('checks the history', () => check())`,
326 errors: [{ messageId: `conditional` }],
327 },
328 {
329 code: `it.runIf(replay.replayPath === undefined)('checks the history', () => check())`,
330 errors: [{ messageId: `conditional`, data: { name: `runIf` } }],
331 },
332 {
333 code: `it.runIf(replay.replayPath !== undefined)('checks the history', check)`,
334 errors: [{ messageId: `conditional` }],
335 },
336 {
337 code: `describe.skipIf(!oracleReplayRequested())('cleanup queue', () => { it('a', () => check()) })`,
338 errors: [{ messageId: `conditional` }],
339 },
340 {
341 code: `describe.skipIf(path.sep === '\\\\')('cleanup queue', () => { it('a', () => check()) })`,
342 errors: [{ messageId: `conditional` }],
343 },
344 {
345 code: `fc.assert(property, replayRequested ? {} : { numRuns: 1 })`,
346 errors: [{ messageId: `singleRun` }],
347 },
348 {
349 code: `fc.assert(property, campaign === 'replay' ? { numRuns: 1 } : {})`,
350 errors: [{ messageId: `singleRun` }],
351 },
352 {
353 code: `fc.assert(property, { seed: process.env.SEED, numRuns: 1 })`,
354 errors: [{ messageId: `singleRun` }],
355 },
356 {
357 code: `fc.assert(property, { seed: replay.replaySeed, numRuns: 1 })`,
358 errors: [{ messageId: `singleRun` }],
359 },
360 {
361 code: `let seed = 1\nfc.assert(property, { seed, numRuns: 1 })`,
362 errors: [{ messageId: `singleRun` }],
363 },
364 {
365 code: `fc.assert(property, { seed: replay.replaySeed, path: undefined, numRuns: 1 })`,
366 errors: [{ messageId: `singleRun` }],
367 },
368 {
369 code: `const propertyTest = replay.replayPath === undefined ? fcTest : fcTest.skip`,
370 errors: [
371 { messageId: `aliasTest`, data: { name: `fcTest` } },
372 { messageId: `alias`, data: { name: `skip` } },
373 ],
374 },
375 {
376 code: `const run = it.skip\nrun('a', () => check())`,
377 errors: [{ messageId: `alias` }],
378 },
379 {
380 code: `const run = fcTest.skip.prop([a])\nrun('a', check)`,
381 errors: [{ messageId: `skip` }],
382 },
383 {
384 code: `if (!replayRequested) { it('a', () => check()) }`,
385 errors: [{ messageId: `guarded` }],
386 },
387 {
388 code: `describe('s', () => { if (requested !== id) { return }\n it('a', () => check()) })`,
389 errors: [{ messageId: `guarded` }],
390 },
391 {
392 code: `process.env.CI || it('a', () => check())`,
393 errors: [{ messageId: `guarded` }],
394 },
395 {
396 code: `const oracleReplayRequested = () => true\nif (!oracleReplayRequested()) { it('a', () => check()) }`,
397 errors: [{ messageId: `guarded` }],
398 },
399 {
400 code: `fc.assert(property, { seed: replay.replaySeed, path: replay.replayPath, numRuns: 1 })`,
401 errors: [{ messageId: `singleRun` }],
402 },
403 {
404 code: `fc.assert(property, { numRuns: 300 })`,
405 errors: [{ messageId: `literalRuns` }],
406 },
407 {
408 code: `fcTest.prop([history], { numRuns: 200 })('checks the history', check)`,
409 errors: [{ messageId: `literalRuns` }],
410 },
411 {
412 code: `import { oracleReplayRequested, oracleReplaySkips, oracleReplayTest } from './oracle-config.js'\nif (process.env.CI) { oracleReplayTest(it)('a', () => check()) }`,
413 languageOptions: { sourceType: `module` },
414 errors: [{ messageId: `guarded` }],
415 },
416 {
417 code: `import { oracleReplayRequested, oracleReplaySkips, oracleReplayTest } from './oracle-config.js'\noracleReplayTest(it).only('a', () => check())`,
418 languageOptions: { sourceType: `module` },
419 errors: [{ messageId: `only` }],
420 },
421 {
422 code: `import { oracleReplayRequested, oracleReplaySkips, oracleReplayTest } from './oracle-config.js'\noracleReplayTest(it).skip('a', () => check())`,
423 languageOptions: { sourceType: `module` },
424 errors: [{ messageId: `skip` }],
425 },
426 {
427 code: `import { oracleReplayRequested, oracleReplaySkips, oracleReplayTest } from './oracle-config.js'\noracleReplayTest(it).skipIf(process.env.CI)('a', () => check())`,
428 languageOptions: { sourceType: `module` },
429 errors: [{ messageId: `conditional` }],
430 },
431 {
432 code: `import { oracleReplayRequested, oracleReplaySkips, oracleReplayTest } from './oracle-config.js'\nif (oracleReplayRequested()) { it('law', () => check()) }`,
433 languageOptions: { sourceType: `module` },
434 errors: [{ messageId: `guarded` }],
435 },
436 {
437 code: `import { oracleReplayRequested, oracleReplaySkips, oracleReplayTest } from './oracle-config.js'\ndescribe('s', () => { if (!oracleReplayRequested()) return\n it('a', () => check()) })`,
438 languageOptions: { sourceType: `module` },
439 errors: [{ messageId: `guarded` }],
440 },
441 {
442 code: `import { oracleReplayRequested, oracleReplaySkips, oracleReplayTest } from './oracle-config.js'\noracleReplayRequested() && it('law', () => check())`,
443 languageOptions: { sourceType: `module` },
444 errors: [{ messageId: `guarded` }],
445 },
446 {
447 code: `const BINDING_RUNS = 12\nfc.assert(property, { numRuns: BINDING_RUNS })`,
448 errors: [{ messageId: `literalRuns` }],
449 },
450 {
451 code: `const replayRuns = 1\nfc.assert(property, { numRuns: replayRuns })`,
452 errors: [{ messageId: `singleRun` }],
453 },
454 {
455 code: `const base = 1\nfc.assert(property, oraclePropertyOptions(base, 'p'))`,
456 errors: [{ messageId: `singleRun` }],
457 },
458 {
459 // The rule reports the alias, and it also sees the skip through it.
460 code: `import { oracleReplayRequested, oracleReplaySkips, oracleReplayTest } from './oracle-config.js'\nconst t = it\nt.skip('a', () => check())`,
461 languageOptions: { sourceType: `module` },
462 errors: [{ messageId: `aliasTest` }, { messageId: `skip` }],
463 },
464 // A registration through a selection helper's result is a registration of
465 // its test, so its modifiers and guards are checked.
466 {
467 code: `import { oracleReplayTest } from './oracle-config.js'\nconst fixedCase = oracleReplayTest(it)\nfixedCase.skip('checks the fixed history', () => check(history))`,
468 languageOptions: { sourceType: `module` },
469 errors: [{ messageId: `skip` }],
470 },
471 {
472 code: `import { oracleReplayTest } from './oracle-config.js'\nconst fixedCase = oracleReplayTest(it)\nfixedCase.only('checks the fixed history', () => check(history))`,
473 languageOptions: { sourceType: `module` },
474 errors: [{ messageId: `only` }],
475 },
476 {
477 code: `import { oracleReplayTest } from './oracle-config.js'\nconst fixedCase = oracleReplayTest(it)\nif (process.env.CI) fixedCase('checks the fixed history', () => check(history))`,
478 languageOptions: { sourceType: `module` },
479 errors: [{ messageId: `guarded` }],
480 },
481 {
482 code: `import { oracleCalibrationTest } from './oracle-config.js'\nconst witness = oracleCalibrationTest(it, 'p', 'fault')\nconst again = witness\nagain.skipIf(process.env.CI)('rejects the mutant', () => check(bad))`,
483 languageOptions: { sourceType: `module` },
484 errors: [{ messageId: `conditional` }],
485 },
486 // A renamed import of a test function is that test function.
487 {
488 code: `import { it as vitestIt } from 'vitest'\nvitestIt.skip('checks a history', () => check(history))`,
489 languageOptions: { sourceType: `module` },
490 errors: [{ messageId: `skip` }],
491 },
492 {
493 code: `import { oracleReplayTest } from './oracle-config.js'\nimport { test as fcTestAlias } from '@fast-check/vitest'\nconst campaign = oracleReplayTest(fcTestAlias, 'p')\ncampaign.todo.prop([history])('checks histories', (h) => check(h))`,
494 languageOptions: { sourceType: `module` },
495 errors: [{ messageId: `skip` }],
496 },
497 {
498 code: `import { oracleReplayRequested, oracleReplaySkips, oracleReplayTest } from './oracle-config.js'\nconst tests = [it, test]\ntests[0]('a', () => check())`,
499 languageOptions: { sourceType: `module` },
500 errors: [{ messageId: `aliasTest` }, { messageId: `aliasTest` }],
501 },
502 {
503 code: `import { oracleReplayRequested, oracleReplaySkips, oracleReplayTest } from './oracle-config.js'\nfor (const c of process.env.CI ? [] : cases) { it(c.name, () => check(c)) }`,
504 languageOptions: { sourceType: `module` },
505 errors: [{ messageId: `guarded` }],
506 },
507 {
508 code: `import { oracleReplayRequested, oracleReplaySkips, oracleReplayTest } from './oracle-config.js'\nfor (const c of cases.filter(() => !process.env.CI)) { it(c.name, () => check(c)) }`,
509 languageOptions: { sourceType: `module` },
510 errors: [{ messageId: `guarded` }],
511 },
512 {
513 code: `import { oracleReplayRequested, oracleReplaySkips, oracleReplayTest } from './oracle-config.js'\nit.each(process.env.CI ? [] : cases)('%s', (c) => check(c))`,
514 languageOptions: { sourceType: `module` },
515 errors: [{ messageId: `guarded` }],
516 },
517 {
518 code: `import { oracleReplayRequested, oracleReplaySkips, oracleReplayTest } from './oracle-config.js'\nconst campaigns = process.env.CI ? [] : cases\nfor (const c of campaigns) { it(c.name, () => check(c)) }`,
519 languageOptions: { sourceType: `module` },
520 errors: [{ messageId: `guarded` }],
521 },
522 {
523 code: `import { oracleReplayRequested, oracleReplaySkips, oracleReplayTest } from './oracle-config.js'\nfor (const c of oracleReplayRequested() ? cases : []) { it(c.name, () => check(c)) }`,
524 languageOptions: { sourceType: `module` },
525 errors: [{ messageId: `guarded` }],
526 },
527 {
528 // A comment does not grant an exception.
529 code: `
530 // oracle-exclusion: known gap
531 it.skip('checks random histories', () => fc.assert(property))
532 `,
533 errors: [{ messageId: `skip` }],
534 },
535 ],
536})