fixtures-directory.js
This file
Path
test/helpers/fixtures-directory.js
27 lines · 1.0 KiB · JavaScript
Last changed by
Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454
History of this fileTake it
The walk stopped after 200 commits: lines older than 9f65b86 point at it.
Upgrade dependencies (#1138)ehmickybefore adoptionabd9fd0
line 1why, one step back1import path from 'node:path';100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 2–3why, one step back2import process from 'node:process';3import {fileURLToPath} from 'node:url';Fix Node 24-specific deprecation warning (#1199)ehmickybefore adoption1ac5b91
line 4why, one step back4import logProcessErrors from 'log-process-errors';100% test coverage (#1018)ehmickybefore adoption9f65b86
line 5why, one step back5import pathKey from 'path-key';Fix Node 24-specific deprecation warning (#1199)ehmickybefore adoption1ac5b91
lines 6–7why, one step back67// Make tests fail if any warning (such as a deprecation warning) is emittedRequire Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454
line 8why, one step back8// eslint-disable-next-line unicorn/no-top-level-side-effects -- must run as soon as this helper is importedFix Node 24-specific deprecation warning (#1199)ehmickybefore adoption1ac5b91
lines 9–15why, one step back9logProcessErrors({10 onError(error, event) {11 if (event === 'warning') {12 throw error;13 }14 },15});100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 16–19why, one step back1617export const PATH_KEY = pathKey();18export const FIXTURES_DIRECTORY_URL = new URL('../fixtures/', import.meta.url);19// @todo: use import.meta.dirname after dropping support for Node <20.11.0Upgrade dependencies (#1138)ehmickybefore adoptionabd9fd0
line 20why, one step back20export const FIXTURES_DIRECTORY = path.resolve(fileURLToPath(FIXTURES_DIRECTORY_URL));100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 21–24why, one step back2122// Add the fixtures directory to PATH so fixtures can be executed without adding23// `node`. This is only meant to make writing tests simpler.24export const setFixtureDirectory = () => {Upgrade dependencies (#1138)ehmickybefore adoptionabd9fd0
line 25why, one step back25 process.env[PATH_KEY] = FIXTURES_DIRECTORY + path.delimiter + process.env[PATH_KEY];100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 26–27why, one step back26};27