import process from 'node:process'; import {randomInt} from 'node:crypto'; import test from 'ava'; const importFresh = async moduleName => import(`${moduleName}?${randomInt(100_000_000)}`); test.serial('not travis', async t => { delete process.env.TRAVIS; delete process.env.CI; const {default: isTravis} = await importFresh('./index.js'); t.false(isTravis); }); test.serial('travis', async t => { process.env.TRAVIS = '1'; process.env.CI = '1'; const {default: isTravis} = await importFresh('./index.js'); t.true(isTravis); });