From 8464a1f23fd584b46bda7fa87086414d1643721e Mon Sep 17 00:00:00 2001 From: soulgalore Date: Sat, 6 Jul 2024 07:42:50 +0200 Subject: [PATCH] Update to eslint unicorn 54 --- bin/browsertime.js | 9 +- lib/android/index.js | 6 +- lib/chrome/webdriver/chromium.js | 10 +- lib/core/engine/collector.js | 4 +- lib/core/engine/command/measure.js | 4 +- lib/core/engine/index.js | 4 +- lib/firefox/geckoProfiler.js | 17 +- lib/firefox/webdriver/firefox.js | 6 +- lib/screenshot/index.js | 8 +- lib/support/engineUtils.js | 13 +- lib/support/fileUtil.js | 6 +- lib/support/filters.js | 4 +- lib/support/images/index.js | 8 +- lib/support/storageManager.js | 16 +- lib/support/tcpdump.js | 8 +- lib/video/postprocessing/finetune/index.js | 12 +- .../visualmetrics/getVideoMetrics.js | 4 +- .../visualmetrics/visualMetrics.js | 10 +- .../firefox/firefoxWindowRecorder.js | 18 +- lib/video/screenRecording/ios/iosRecorder.js | 9 +- .../screenRecording/iosSimulator/recorder.js | 4 +- lib/video/video.js | 19 +- package-lock.json | 413 ++++++------------ package.json | 2 +- test/commandtests/actionTest.js | 3 +- test/commandtests/chromeTest.js | 3 +- test/commandtests/clickTest.js | 3 +- test/commandtests/firefoxTest.js | 3 +- test/commandtests/measureTest.js | 3 +- test/commandtests/miscTest.js | 3 +- test/commandtests/scrollTest.js | 3 +- test/commandtests/stopWatch.js | 3 +- test/commandtests/unified.js | 3 +- test/engineTest.js | 3 +- test/unittests/browserScriptsTest.js | 3 +- test/unittests/userTimingTest.js | 3 +- 36 files changed, 261 insertions(+), 389 deletions(-) diff --git a/bin/browsertime.js b/bin/browsertime.js index 92b53aa2e9..980ae7efba 100755 --- a/bin/browsertime.js +++ b/bin/browsertime.js @@ -4,7 +4,7 @@ import get from 'lodash.get'; import set from 'lodash.set'; import intel from 'intel'; import { existsSync, mkdirSync } from 'node:fs'; -import { resolve, relative } from 'node:path'; +import path from 'node:path'; import { Engine } from '../lib/core/engine/index.js'; import { findAndParseScripts, @@ -25,7 +25,7 @@ async function parseUserScripts(scripts) { if (!Array.isArray(scripts)) scripts = [scripts]; const results = {}; for (const script of scripts) { - const code = await findAndParseScripts(resolve(script), 'custom'); + const code = await findAndParseScripts(path.resolve(script), 'custom'); merge(results, code); } return results; @@ -125,7 +125,10 @@ async function run(urls, options) { await Promise.all(saveOperations); - const resultDirectory = relative(process.cwd(), storageManager.directory); + const resultDirectory = path.relative( + process.cwd(), + storageManager.directory + ); // check for errors // If we have set the exit code in scripts, respect that diff --git a/lib/android/index.js b/lib/android/index.js index fcb81491d2..e0a4b87049 100644 --- a/lib/android/index.js +++ b/lib/android/index.js @@ -1,6 +1,6 @@ import { promisify } from 'node:util'; import { mkdir as _mkdir, createWriteStream } from 'node:fs'; -import { join } from 'node:path'; +import path from 'node:path'; import { EOL as endOfLine } from 'node:os'; import { execa } from 'execa'; import intel from 'intel'; @@ -105,7 +105,7 @@ export class Android { for (const file of files) { const fullSourcePath = `${sourcePath}/${file.name}`; - const fullDestinationPath = join(destinationPath, file.name); + const fullDestinationPath = path.join(destinationPath, file.name); if (file.isFile()) { await this._downloadFile(fullSourcePath, fullDestinationPath); @@ -475,7 +475,7 @@ export class Android { async getUsbPowerUsageProfile(index, url, result, options, storageManager) { let profileData = await usbPowerProfiler.profileFromData(); - let destinationFilename = join( + let destinationFilename = path.join( await pathToFolder(url, options), `powerProfile-${index}.json` ); diff --git a/lib/chrome/webdriver/chromium.js b/lib/chrome/webdriver/chromium.js index 2a62c7db63..d2cbd2a8d3 100644 --- a/lib/chrome/webdriver/chromium.js +++ b/lib/chrome/webdriver/chromium.js @@ -1,6 +1,6 @@ import { promisify } from 'node:util'; import { unlink as _unlink, rm as _rm } from 'node:fs'; -import { join } from 'node:path'; +import path from 'node:path'; import { logging } from 'selenium-webdriver'; import intel from 'intel'; import usbPowerProfiler from 'usb-power-profiling/usb-power-profiling.js'; @@ -261,12 +261,12 @@ export class Chromium { if (this.chrome.collectNetLog && !this.chrome.android) { await this.storageManager.createSubDataDir( - join(pathToFolder(result.url, this.options)) + path.join(pathToFolder(result.url, this.options)) ); await this.storageManager.gzip( `${this.baseDir}/chromeNetlog.json`, - join( + path.join( this.baseDir, pathToFolder(result.url, this.options), `chromeNetlog-${index}.json.gz` @@ -350,13 +350,13 @@ export class Chromium { if (this.chrome.collectNetLog && this.chrome.android) { // THIS needs to be unique per page - const filename = join( + const filename = path.join( this.baseDir, pathToFolder(result.url, this.options), `chromeNetlog-${index}.json` ); - const gzFilename = join( + const gzFilename = path.join( this.baseDir, pathToFolder(result.url, this.options), `chromeNetlog-${index}.json.gz` diff --git a/lib/core/engine/collector.js b/lib/core/engine/collector.js index 568e6e25a0..9f7e58ba32 100644 --- a/lib/core/engine/collector.js +++ b/lib/core/engine/collector.js @@ -1,4 +1,4 @@ -import { join } from 'node:path'; +import path from 'node:path'; import { createRequire } from 'node:module'; import get from 'lodash.get'; import intel from 'intel'; @@ -482,7 +482,7 @@ export class Collector { for (let filename of Object.keys(data.extraJson)) { extraWork.push( this.storageManager.writeJson( - join(pathToFolder(url, this.options), filename), + path.join(pathToFolder(url, this.options), filename), data.extraJson[filename], true ) diff --git a/lib/core/engine/command/measure.js b/lib/core/engine/command/measure.js index f72bf59281..a196e295b2 100644 --- a/lib/core/engine/command/measure.js +++ b/lib/core/engine/command/measure.js @@ -1,4 +1,4 @@ -import { join } from 'node:path'; +import path from 'node:path'; import intel from 'intel'; import get from 'lodash.get'; import merge from 'lodash.merge'; @@ -429,7 +429,7 @@ export class Measure { // We have the URL, create the data dir await this.storageManager.createSubDataDir( - join(pathToFolder(url, this.options)) + path.join(pathToFolder(url, this.options)) ); await this._stopVideo(url); diff --git a/lib/core/engine/index.js b/lib/core/engine/index.js index 3cbea35f14..c4dd566906 100644 --- a/lib/core/engine/index.js +++ b/lib/core/engine/index.js @@ -224,7 +224,7 @@ export class Engine { } } - return Promise.all([this.myXVFB.start()]); + return this.myXVFB.start(); } async runByScript( @@ -518,6 +518,6 @@ export class Engine { await this.gnirehtet.stop(); } - return Promise.all([this.myXVFB.stop()]); + return this.myXVFB.stop(); } } diff --git a/lib/firefox/geckoProfiler.js b/lib/firefox/geckoProfiler.js index ae9b28fd21..1a83dd3757 100644 --- a/lib/firefox/geckoProfiler.js +++ b/lib/firefox/geckoProfiler.js @@ -1,4 +1,4 @@ -import { join } from 'node:path'; +import path from 'node:path'; import get from 'lodash.get'; import intel from 'intel'; import { geckoProfilerDefaults } from './settings/geckoProfilerDefaults.js'; @@ -156,9 +156,12 @@ export class GeckoProfiler { const options = this.options; let profileDir = await storageManager.createSubDataDir( - join(pathToFolder(url, options)) + path.join(pathToFolder(url, options)) + ); + let destinationFilename = path.join( + profileDir, + `geckoProfile-${index}.json` ); - let destinationFilename = join(profileDir, `geckoProfile-${index}.json`); let deviceProfileFilename = destinationFilename; if (isAndroidConfigured(options)) { @@ -214,7 +217,7 @@ export class GeckoProfiler { const profile = JSON.parse( await storageManager.readData( `geckoProfile-${index}.json`, - join(pathToFolder(url, options)) + path.join(pathToFolder(url, options)) ) ); let power = 0; @@ -237,7 +240,11 @@ export class GeckoProfiler { ? `geckoProfile-${index}-extra.json.gz` : `geckoProfile-${index}.json.gz`; await timeout( - storageManager.gzip(destinationFilename, join(profileDir, name), true), + storageManager.gzip( + destinationFilename, + path.join(profileDir, name), + true + ), 300_000, // 5 minutes 'Could not gzip the profile.' ); diff --git a/lib/firefox/webdriver/firefox.js b/lib/firefox/webdriver/firefox.js index e39f57e595..03682ae7d8 100644 --- a/lib/firefox/webdriver/firefox.js +++ b/lib/firefox/webdriver/firefox.js @@ -1,6 +1,6 @@ import { rename as _rename } from 'node:fs'; import { promisify } from 'node:util'; -import { join } from 'node:path'; +import path from 'node:path'; import intel from 'intel'; import get from 'lodash.get'; import usbPowerProfiler from 'usb-power-profiling/usb-power-profiling.js'; @@ -312,7 +312,7 @@ export class Firefox { for (const file of files) { await rename( `${this.baseDir}/${file}`, - join( + path.join( this.baseDir, pathToFolder(result.url, this.options), `${file}-${index}.txt` @@ -358,7 +358,7 @@ export class Firefox { geckoProfile.meta.visualMetrics = result.visualMetrics; await this.storageManager.writeJson( - join(profileSubdir, `geckoProfile-${index}.json`), + path.join(profileSubdir, `geckoProfile-${index}.json`), geckoProfile, true ); diff --git a/lib/screenshot/index.js b/lib/screenshot/index.js index 7a3b04e127..5feafbaae5 100644 --- a/lib/screenshot/index.js +++ b/lib/screenshot/index.js @@ -1,4 +1,4 @@ -import { join } from 'node:path'; +import path from 'node:path'; import merge from 'lodash.merge'; import intel from 'intel'; import { screenshotDefaults } from './defaults.js'; @@ -36,7 +36,7 @@ export class ScreenshotManager { data, url, this.storageManager, - join(SCREENSHOT_DIR, `${index}`), + path.join(SCREENSHOT_DIR, `${index}`), this.options ); this.savedScreenshots.push( @@ -50,7 +50,7 @@ export class ScreenshotManager { url, this.storageManager, this.config, - join(SCREENSHOT_DIR, `${index}`), + path.join(SCREENSHOT_DIR, `${index}`), this.options ); this.savedScreenshots.push( @@ -63,7 +63,7 @@ export class ScreenshotManager { url, this.storageManager, this.config, - join(SCREENSHOT_DIR, `${index}`), + path.join(SCREENSHOT_DIR, `${index}`), this.options ); this.savedScreenshots.push( diff --git a/lib/support/engineUtils.js b/lib/support/engineUtils.js index 39ff19885f..00d480aa9d 100644 --- a/lib/support/engineUtils.js +++ b/lib/support/engineUtils.js @@ -1,4 +1,4 @@ -import { resolve, dirname, join } from 'node:path'; +import path from 'node:path'; import { promisify } from 'node:util'; import { writeFile as _writeFile, @@ -32,7 +32,7 @@ async function loadFile(script, options, throwError) { script.endsWith('.mjs') || script.endsWith('.cjs') ) { - let myFunction = await import(pathToFileURL(resolve(script))); + let myFunction = await import(pathToFileURL(path.resolve(script))); return myFunction.default ?? myFunction; } else { // Hack a way! Try to add a package.json file in the same folder as the @@ -43,7 +43,10 @@ async function loadFile(script, options, throwError) { ); let createdPackageJson = false; try { - const packageJson = join(dirname(resolve(script)), 'package.json'); + const packageJson = path.join( + path.dirname(path.resolve(script)), + 'package.json' + ); try { await writeFile(packageJson, '{}'); createdPackageJson = true; @@ -53,7 +56,7 @@ async function loadFile(script, options, throwError) { script ); } - const myFunction = await import(resolve(script)); + const myFunction = await import(path.resolve(script)); try { if (createdPackageJson) { @@ -89,7 +92,7 @@ export async function loadPrePostScripts(scripts, options) { export async function loadPageCompleteScript(script) { if (script && script.endsWith('js')) { - return readFile(resolve(script), 'utf8'); + return readFile(path.resolve(script), 'utf8'); } return script; } diff --git a/lib/support/fileUtil.js b/lib/support/fileUtil.js index 1c9293415a..0092f54d9e 100644 --- a/lib/support/fileUtil.js +++ b/lib/support/fileUtil.js @@ -1,4 +1,4 @@ -import { join } from 'node:path'; +import path from 'node:path'; import { promisify } from 'node:util'; import { readdir as _readdir, @@ -50,7 +50,7 @@ export async function removeDirAndFiles(dirName) { await Promise.all( files.map(async file => { try { - const p = join(dir, file); + const p = path.join(dir, file); const stat = await lstat(p); await (stat.isDirectory() ? removeDir(p) : unlink(p)); } catch (error) { @@ -68,7 +68,7 @@ export async function removeDirAndFiles(dirName) { export async function removeByType(dir, type) { const fileNames = await readdir(dir); const filePaths = fileNames - .map(fileName => join(dir, fileName)) + .map(fileName => path.join(dir, fileName)) .filter(element => onlyFiles(element)) .filter(onlyWithExtension('.' + type)); diff --git a/lib/support/filters.js b/lib/support/filters.js index db64bff594..de650df984 100644 --- a/lib/support/filters.js +++ b/lib/support/filters.js @@ -1,13 +1,13 @@ import { promisify } from 'node:util'; import { stat as _stat } from 'node:fs'; -import { extname } from 'node:path'; +import path from 'node:path'; const stat = promisify(_stat); /** * Filters to use with Array.prototype.filter, e.g. ['/a/path', '/another/path'].filter(onlyFiles) */ export function onlyWithExtension(extension) { - return filepath => extname(filepath) === extension; + return filepath => path.extname(filepath) === extension; } export async function onlyFiles(filepath) { const stats = await stat(filepath); diff --git a/lib/support/images/index.js b/lib/support/images/index.js index 95393ce005..3ff0f8215a 100644 --- a/lib/support/images/index.js +++ b/lib/support/images/index.js @@ -1,4 +1,4 @@ -import { join } from 'node:path'; +import path from 'node:path'; import { pathToFolder } from '../pathToFolder.js'; export async function savePngWithoutResize( @@ -12,7 +12,7 @@ export async function savePngWithoutResize( return storageManager.writeData( `${name}.png`, data, - join(pathToFolder(url, options), dir) + path.join(pathToFolder(url, options), dir) ); } export async function savePng( @@ -41,7 +41,7 @@ export async function savePng( return storageManager.writeData( `${name}.png`, buffer, - join(pathToFolder(url, options), dir) + path.join(pathToFolder(url, options), dir) ); } } @@ -70,7 +70,7 @@ export async function saveJpg( return storageManager.writeData( `${name}.jpg`, buffer, - join(pathToFolder(url, options), dir) + path.join(pathToFolder(url, options), dir) ); } } diff --git a/lib/support/storageManager.js b/lib/support/storageManager.js index ea4cd6fbfb..acd72e301c 100644 --- a/lib/support/storageManager.js +++ b/lib/support/storageManager.js @@ -1,4 +1,4 @@ -import { resolve as _resolve, join } from 'node:path'; +import path from 'node:path'; import { createHash } from 'node:crypto'; import { gunzip as _gunzip, gzip as _gzip, createGzip } from 'node:zlib'; import { parse } from 'node:url'; @@ -52,8 +52,8 @@ async function streamToString(stream) { export class StorageManager { constructor(url, { resultDir, prettyPrint = false } = {}) { this.baseDir = resultDir - ? _resolve(resultDir) - : _resolve(defaultDir, pathNameFromUrl(url), timestamp); + ? path.resolve(resultDir) + : path.resolve(defaultDir, pathNameFromUrl(url), timestamp); this.jsonIndentation = prettyPrint ? 2 : 0; } @@ -63,13 +63,13 @@ export class StorageManager { } async createSubDataDir(...name) { - const dir = join(this.baseDir, ...name); + const dir = path.join(this.baseDir, ...name); await mkdir(dir, { recursive: true }); return dir; } async rm(filename) { - return unlink(join(this.baseDir, filename)); + return unlink(path.join(this.baseDir, filename)); } async writeData(filename, data, subdir) { @@ -77,7 +77,7 @@ export class StorageManager { dirPath = await (subdir ? this.createSubDataDir(subdir) : this.createDataDir()); - const fullPath = join(dirPath, filename); + const fullPath = path.join(dirPath, filename); return writeFile(fullPath, data).then(() => { return fullPath; }); @@ -96,8 +96,8 @@ export class StorageManager { async readData(filename, subdir) { let filepath; filepath = subdir - ? join(this.baseDir, subdir, filename) - : join(this.baseDir, filename); + ? path.join(this.baseDir, subdir, filename) + : path.join(this.baseDir, filename); if (filename.endsWith('.gz')) { const readStream = createReadStream(filepath); diff --git a/lib/support/tcpdump.js b/lib/support/tcpdump.js index b9121e551f..e34d07428d 100644 --- a/lib/support/tcpdump.js +++ b/lib/support/tcpdump.js @@ -1,4 +1,4 @@ -import { join } from 'node:path'; +import path from 'node:path'; import { execa } from 'execa'; import { pathToFolder } from './pathToFolder.js'; import { rename } from './fileUtil.js'; @@ -9,7 +9,7 @@ export class TCPDump { this.options = options; } async start(iteration) { - const captureFile = join(this.baseDir, iteration + '.pcap'); + const captureFile = path.join(this.baseDir, iteration + '.pcap'); const parameters = [ 'tcpdump', '-i', @@ -36,8 +36,8 @@ export class TCPDump { } async mv(url, iteration) { - const oldLocation = join(this.baseDir, iteration + '.pcap'); - const newLocation = join( + const oldLocation = path.join(this.baseDir, iteration + '.pcap'); + const newLocation = path.join( this.baseDir, pathToFolder(url, this.options), iteration + '.pcap' diff --git a/lib/video/postprocessing/finetune/index.js b/lib/video/postprocessing/finetune/index.js index 6550ec7ab9..66eb1e9aac 100644 --- a/lib/video/postprocessing/finetune/index.js +++ b/lib/video/postprocessing/finetune/index.js @@ -1,4 +1,4 @@ -import { join } from 'node:path'; +import path from 'node:path'; import { rename as _rename, copyFile as _copyFile, @@ -26,10 +26,10 @@ export async function finetuneVideo( options ) { const newStart = videoMetrics.videoRecordingStart / 1000; - let temporaryFile = join(videoDir, 'tmp.mp4'); + let temporaryFile = path.join(videoDir, 'tmp.mp4'); if (get(options, 'videoParams.keepOriginalVideo', false)) { - const originalFile = join(videoDir, index + '-original.mp4'); + const originalFile = path.join(videoDir, index + '-original.mp4'); await copyFile(videoPath, originalFile); } @@ -59,19 +59,19 @@ export async function finetuneVideo( isAndroidConfigured(options) && get(options, 'videoParams.convert', _convert) ) { - const temporaryFile2 = join(videoDir, 'tmp-60fps.mp4'); + const temporaryFile2 = path.join(videoDir, 'tmp-60fps.mp4'); await convert(temporaryFile, temporaryFile2, 60); await unlink(temporaryFile); await rename(temporaryFile2, temporaryFile); } else if (options.safari && options.safari.useSimulator) { - const temporaryFile2 = join(videoDir, 'tmp-60fps.mp4'); + const temporaryFile2 = path.join(videoDir, 'tmp-60fps.mp4'); await convert(temporaryFile, temporaryFile2, 60); await unlink(temporaryFile); await rename(temporaryFile2, temporaryFile); } if (options.videoParams.addTimer) { - const temporaryFile2 = join(videoDir, 'tmp2.mp4'); + const temporaryFile2 = path.join(videoDir, 'tmp2.mp4'); await addTextToVideo( temporaryFile, temporaryFile2, diff --git a/lib/video/postprocessing/visualmetrics/getVideoMetrics.js b/lib/video/postprocessing/visualmetrics/getVideoMetrics.js index 58d8e93e58..73fed25620 100644 --- a/lib/video/postprocessing/visualmetrics/getVideoMetrics.js +++ b/lib/video/postprocessing/visualmetrics/getVideoMetrics.js @@ -1,4 +1,4 @@ -import { join } from 'node:path'; +import path from 'node:path'; import intel from 'intel'; import { run } from './visualMetrics.js'; import { extraMetrics } from './extraMetrics.js'; @@ -25,7 +25,7 @@ export async function getVideoMetrics( true ); } - const elementsFile = join( + const elementsFile = path.join( storageManager.directory, index + '-visualElements.json.gz' ); diff --git a/lib/video/postprocessing/visualmetrics/visualMetrics.js b/lib/video/postprocessing/visualmetrics/visualMetrics.js index 6f0949fcef..d38cc2a4e5 100644 --- a/lib/video/postprocessing/visualmetrics/visualMetrics.js +++ b/lib/video/postprocessing/visualmetrics/visualMetrics.js @@ -1,5 +1,4 @@ import { fileURLToPath } from 'node:url'; -import { join } from 'node:path'; import path from 'node:path'; import { execa } from 'execa'; import intel from 'intel'; @@ -8,7 +7,7 @@ import { readFile, removeFile, copyFile } from '../../../support/fileUtil.js'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const log = intel.getLogger('browsertime.video'); -const SCRIPT_PATH = join( +const SCRIPT_PATH = path.join( __dirname, '..', '..', @@ -18,7 +17,7 @@ const SCRIPT_PATH = join( 'visualmetrics.py' ); -const PORTABLE_SCRIPT_PATH = join( +const PORTABLE_SCRIPT_PATH = path.join( __dirname, '..', '..', @@ -120,7 +119,10 @@ export async function run( } } - const visualMetricsLogFile = join(videoDir, index + '.visualmetrics.log'); + const visualMetricsLogFile = path.join( + videoDir, + index + '.visualmetrics.log' + ); scriptArguments.push('--logfile', visualMetricsLogFile); if (options.verbose >= 1) { diff --git a/lib/video/screenRecording/firefox/firefoxWindowRecorder.js b/lib/video/screenRecording/firefox/firefoxWindowRecorder.js index ea43f7f24b..8512811c08 100644 --- a/lib/video/screenRecording/firefox/firefoxWindowRecorder.js +++ b/lib/video/screenRecording/firefox/firefoxWindowRecorder.js @@ -6,7 +6,7 @@ import { createWriteStream, copyFileSync } from 'node:fs'; -import { join } from 'node:path'; +import path from 'node:path'; import intel from 'intel'; import { execa } from 'execa'; import { removeDirAndFiles } from '../../../support/fileUtil.js'; @@ -41,7 +41,7 @@ function findRecordingDirectory(baseDir) { for (const file of readdirSync(baseDir)) { if (file.startsWith('windowrecording-')) { - let fullPath = join(baseDir, file); + let fullPath = path.join(baseDir, file); let mtime = statSync(fullPath).mtime; if (mtime > closest_mtime) { closest_mtime = mtime; @@ -79,17 +79,19 @@ function findTimeToFirstFrame(recordingDir) { function writeFrameDurationsToFile(directoryName, imageFiles) { return new Promise((resolve, reject) => { - const stream = createWriteStream(join(directoryName, 'durations.txt')); + const stream = createWriteStream(path.join(directoryName, 'durations.txt')); stream.once('open', function () { stream.write( - "file '" + join(directoryName, imageFiles[0].filename) + "'\n" + "file '" + path.join(directoryName, imageFiles[0].filename) + "'\n" ); for (let index = 1; index < imageFiles.length; index++) { let duration = (imageFiles[index].offset - imageFiles[index - 1].offset) / 1000; stream.write('duration ' + duration.toString() + '\n'); stream.write( - "file '" + join(directoryName, imageFiles[index].filename) + "'\n" + "file '" + + path.join(directoryName, imageFiles[index].filename) + + "'\n" ); } stream.end(); @@ -114,8 +116,8 @@ async function generateVideo(destination, recordingDirectoryName) { let newFilename = 'frame' + frameno + '.png'; let offset = fields[2].split('.')[0]; copyFileSync( - join(recordingDirectoryName, file), - join(recordingDirectoryName, newFilename) + path.join(recordingDirectoryName, file), + path.join(recordingDirectoryName, newFilename) ); imageFiles.push({ filename: newFilename, offset: offset }); } @@ -133,7 +135,7 @@ async function generateVideo(destination, recordingDirectoryName) { '-safe', '0', '-i', - join(recordingDirectoryName, 'durations.txt'), + path.join(recordingDirectoryName, 'durations.txt'), '-vf', 'pad=ceil(iw/2)*2:ceil(ih/2)*2', '-vsync', diff --git a/lib/video/screenRecording/ios/iosRecorder.js b/lib/video/screenRecording/ios/iosRecorder.js index e2e25ec8f6..5d2e8ba5ef 100644 --- a/lib/video/screenRecording/ios/iosRecorder.js +++ b/lib/video/screenRecording/ios/iosRecorder.js @@ -1,6 +1,5 @@ import { fileURLToPath } from 'node:url'; import path from 'node:path'; -import { resolve, join } from 'node:path'; import { execaCommand as command } from 'execa'; import { promisify } from 'node:util'; import { unlink as _unlink } from 'node:fs'; @@ -9,16 +8,16 @@ import intel from 'intel'; const log = intel.getLogger('browsertime.video'); const unlink = promisify(_unlink); const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const moduleRootPath = resolve(__dirname, '..', '..', '..', '..'); -const QVH = resolve(moduleRootPath, 'vendor', 'mac', 'x86', 'qvh'); +const moduleRootPath = path.resolve(__dirname, '..', '..', '..', '..'); +const QVH = path.resolve(moduleRootPath, 'vendor', 'mac', 'x86', 'qvh'); const delay = ms => new Promise(res => setTimeout(res, ms)); export class IOSRecorder { constructor(options, baseDir) { this.options = options; this.uuid = options.safari.deviceUDID; - this.tmpVideo = join(baseDir, 'tmp.h264'); - this.tmpSound = join(baseDir, 'tmp.wav'); + this.tmpVideo = path.join(baseDir, 'tmp.h264'); + this.tmpSound = path.join(baseDir, 'tmp.wav'); } static async activate() { diff --git a/lib/video/screenRecording/iosSimulator/recorder.js b/lib/video/screenRecording/iosSimulator/recorder.js index 4722b40e92..a4efe810c0 100644 --- a/lib/video/screenRecording/iosSimulator/recorder.js +++ b/lib/video/screenRecording/iosSimulator/recorder.js @@ -1,10 +1,10 @@ import path from 'node:path'; -import util from 'node:util'; +import { promisify } from 'node:util'; import fs from 'node:fs'; import { execaCommand } from 'execa'; import intel from 'intel'; import { convert } from './convertToMp4.js'; -const unlink = util.promisify(fs.unlink); +const unlink = promisify(fs.unlink); const delay = ms => new Promise(res => setTimeout(res, ms)); const log = intel.getLogger('browsertime.video'); diff --git a/lib/video/video.js b/lib/video/video.js index 5311a6f7e6..0a71c786b8 100644 --- a/lib/video/video.js +++ b/lib/video/video.js @@ -1,4 +1,4 @@ -import { join } from 'node:path'; +import path from 'node:path'; import get from 'lodash.get'; import { getRecorder } from './screenRecording/recorder.js'; import { getVideoMetrics } from './postprocessing/visualmetrics/getVideoMetrics.js'; @@ -24,15 +24,15 @@ export class Video { this.index = index; this.videoDir = await storageManager.createSubDataDir( - join(pathToFolder(url, this.options), 'video') + path.join(pathToFolder(url, this.options), 'video') ); await storageManager.createSubDataDir( - join(pathToFolder(url, this.options), 'video', 'images', '' + index) + path.join(pathToFolder(url, this.options), 'video', 'images', '' + index) ); this.filmstripDir = await storageManager.createSubDataDir( - join(pathToFolder(url, this.options), 'filmstrip', '' + index) + path.join(pathToFolder(url, this.options), 'filmstrip', '' + index) ); } @@ -47,7 +47,7 @@ export class Video { // skip recording if we already have one going if (!this.isRecording) { this.isRecording = true; - let temporary = join(this.tmpDir, 'x11-tmp.mp4'); + let temporary = path.join(this.tmpDir, 'x11-tmp.mp4'); return this.recorder.start(temporary); } } @@ -61,7 +61,7 @@ export class Video { if (url === undefined) { return this.recorder.stop(this.videoPath); } else { - this.videoPath = join( + this.videoPath = path.join( this.storageManager.directory, pathToFolder(url, this.options), 'video', @@ -75,13 +75,16 @@ export class Video { async cleanup() { // Keep or remove the original file if (get(this.options, 'videoParams.keepOriginalVideo', false)) { - const originalFile = join(this.videoDir, this.index + '-original.mp4'); + const originalFile = path.join( + this.videoDir, + this.index + '-original.mp4' + ); await rename(this.videoPath, originalFile); } else { await removeFile(this.videoPath); } // Remove all tmp videos (and screenshots) - return removeDirAndFiles(join(this.videoDir, 'tmp')); + return removeDirAndFiles(path.join(this.videoDir, 'tmp')); } /** diff --git a/package-lock.json b/package-lock.json index 0541a0d776..bca38fedea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,7 @@ "eslint": "9.6.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-prettier": "5.1.3", - "eslint-plugin-unicorn": "51.0.1", + "eslint-plugin-unicorn": "54.0.0", "jsdoc": "4.0.3", "prettier": "3.3.2", "serve": "14.2.3", @@ -83,9 +83,9 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", - "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", + "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", "dev": true, "engines": { "node": ">=6.9.0" @@ -296,15 +296,15 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", - "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", + "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", + "espree": "^10.0.1", + "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -312,16 +312,16 @@ "strip-json-comments": "^3.1.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" } }, "node_modules/@eslint/eslintrc/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", "dev": true, "dependencies": { "ms": "2.1.2" @@ -2003,9 +2003,9 @@ } }, "node_modules/browserslist": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz", - "integrity": "sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==", + "version": "4.23.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.1.tgz", + "integrity": "sha512-TUfofFo/KsK/bWZ9TWQ5O26tsWW4Uhmt8IYklbnUa70udB6P2wA7w7o4PY4muaEPBQaAX+CEnmmIA41NVHtPVw==", "dev": true, "funding": [ { @@ -2022,10 +2022,10 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001565", - "electron-to-chromium": "^1.4.601", + "caniuse-lite": "^1.0.30001629", + "electron-to-chromium": "^1.4.796", "node-releases": "^2.0.14", - "update-browserslist-db": "^1.0.13" + "update-browserslist-db": "^1.0.16" }, "bin": { "browserslist": "cli.js" @@ -2137,9 +2137,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001576", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001576.tgz", - "integrity": "sha512-ff5BdakGe2P3SQsMsiqmt1Lc8221NR1VzHj5jXN5vBny9A6fpze94HiVV/n7XRosOlsShJcvMv5mdnpjOGCEgg==", + "version": "1.0.30001640", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001640.tgz", + "integrity": "sha512-lA4VMpW0PSUrFnkmVuEKBUovSWKhj7puyCg8StBChgu298N1AtuF1sKWEvfDuimSEDbhlb/KqPKC3fs1HbuQUA==", "dev": true, "funding": [ { @@ -2782,12 +2782,12 @@ } }, "node_modules/core-js-compat": { - "version": "3.35.0", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.35.0.tgz", - "integrity": "sha512-5blwFAddknKeNgsjBzilkdQ0+YK8L1PfqPYq40NOYMYFSS38qj+hpTcLLWwpIwA2A5bje/x5jmVn2tzUMg9IVw==", + "version": "3.37.1", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.37.1.tgz", + "integrity": "sha512-9TNiImhKvQqSUkOvk/mMRZzOANTiEVC7WaBNhHcKM7x+/5E1l5NvsysR19zuDQScE8k+kfQXWRN3AtS/eOSHpg==", "dev": true, "dependencies": { - "browserslist": "^4.22.2" + "browserslist": "^4.23.0" }, "funding": { "type": "opencollective", @@ -2913,9 +2913,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.630", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.630.tgz", - "integrity": "sha512-osHqhtjojpCsACVnuD11xO5g9xaCyw7Qqn/C2KParkMv42i8jrJJgx3g7mkHfpxwhy9MnOJr8+pKOdZ7qzgizg==", + "version": "1.4.818", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.818.tgz", + "integrity": "sha512-eGvIk2V0dGImV9gWLq8fDfTTsCAeMDwZqEPMr+jMInxZdnp9Us8UpovYpRCf9NQ7VOFgrN2doNSgvISbsbNpxA==", "dev": true }, "node_modules/emittery": { @@ -2957,9 +2957,9 @@ } }, "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", + "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", "engines": { "node": ">=6" } @@ -3066,17 +3066,17 @@ } }, "node_modules/eslint-plugin-unicorn": { - "version": "51.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-51.0.1.tgz", - "integrity": "sha512-MuR/+9VuB0fydoI0nIn2RDA5WISRn4AsJyNSaNKLVwie9/ONvQhxOBbkfSICBPnzKrB77Fh6CZZXjgTt/4Latw==", + "version": "54.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-54.0.0.tgz", + "integrity": "sha512-XxYLRiYtAWiAjPv6z4JREby1TAE2byBC7wlh0V4vWDCpccOSU1KovWV//jqPXF6bq3WKxqX9rdjoRQ1EhdmNdQ==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.22.20", + "@babel/helper-validator-identifier": "^7.24.5", "@eslint-community/eslint-utils": "^4.4.0", - "@eslint/eslintrc": "^2.1.4", + "@eslint/eslintrc": "^3.0.2", "ci-info": "^4.0.0", "clean-regexp": "^1.0.0", - "core-js-compat": "^3.34.0", + "core-js-compat": "^3.37.0", "esquery": "^1.5.0", "indent-string": "^4.0.0", "is-builtin-module": "^3.2.1", @@ -3085,11 +3085,11 @@ "read-pkg-up": "^7.0.1", "regexp-tree": "^0.1.27", "regjsparser": "^0.10.0", - "semver": "^7.5.4", + "semver": "^7.6.1", "strip-indent": "^3.0.0" }, "engines": { - "node": ">=16" + "node": ">=18.18" }, "funding": { "url": "https://github.com/sindresorhus/eslint-plugin-unicorn?sponsor=1" @@ -3135,29 +3135,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/@eslint/eslintrc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", - "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", - "dev": true, - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^10.0.1", - "globals": "^14.0.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/eslint/node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -3239,23 +3216,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/espree": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.1.0.tgz", - "integrity": "sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==", - "dev": true, - "dependencies": { - "acorn": "^8.12.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.0.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/eslint/node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -3272,18 +3232,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint/node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", - "dev": true, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/eslint/node_modules/is-path-inside": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", @@ -3350,18 +3298,6 @@ "node": ">=8" } }, - "node_modules/eslint/node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/eslint/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -3387,17 +3323,29 @@ } }, "node_modules/espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.1.0.tgz", + "integrity": "sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==", "dev": true, "dependencies": { - "acorn": "^8.9.0", + "acorn": "^8.12.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" + "eslint-visitor-keys": "^4.0.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", + "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -3931,15 +3879,12 @@ } }, "node_modules/globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, "engines": { - "node": ">=8" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -4773,18 +4718,6 @@ "tslib": "^2.0.3" } }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -5562,9 +5495,9 @@ "optional": true }, "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", "dev": true }, "node_modules/picomatch": { @@ -6138,13 +6071,10 @@ } }, "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, "bin": { "semver": "bin/semver.js" }, @@ -6888,18 +6818,6 @@ "node": ">= 0.8.0" } }, - "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/typescript": { "version": "5.5.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", @@ -6951,9 +6869,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", - "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", + "integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==", "dev": true, "funding": [ { @@ -6970,8 +6888,8 @@ } ], "dependencies": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" + "escalade": "^3.1.2", + "picocolors": "^1.0.1" }, "bin": { "update-browserslist-db": "cli.js" @@ -7469,9 +7387,9 @@ } }, "@babel/helper-validator-identifier": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", - "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", + "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", "dev": true }, "@babel/highlight": { @@ -7624,15 +7542,15 @@ } }, "@eslint/eslintrc": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", - "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", + "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", + "espree": "^10.0.1", + "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -7641,9 +7559,9 @@ }, "dependencies": { "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", "dev": true, "requires": { "ms": "2.1.2" @@ -8844,15 +8762,15 @@ } }, "browserslist": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz", - "integrity": "sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==", + "version": "4.23.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.1.tgz", + "integrity": "sha512-TUfofFo/KsK/bWZ9TWQ5O26tsWW4Uhmt8IYklbnUa70udB6P2wA7w7o4PY4muaEPBQaAX+CEnmmIA41NVHtPVw==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001565", - "electron-to-chromium": "^1.4.601", + "caniuse-lite": "^1.0.30001629", + "electron-to-chromium": "^1.4.796", "node-releases": "^2.0.14", - "update-browserslist-db": "^1.0.13" + "update-browserslist-db": "^1.0.16" } }, "btoa": { @@ -8917,9 +8835,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001576", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001576.tgz", - "integrity": "sha512-ff5BdakGe2P3SQsMsiqmt1Lc8221NR1VzHj5jXN5vBny9A6fpze94HiVV/n7XRosOlsShJcvMv5mdnpjOGCEgg==", + "version": "1.0.30001640", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001640.tgz", + "integrity": "sha512-lA4VMpW0PSUrFnkmVuEKBUovSWKhj7puyCg8StBChgu298N1AtuF1sKWEvfDuimSEDbhlb/KqPKC3fs1HbuQUA==", "dev": true }, "catharsis": { @@ -9382,12 +9300,12 @@ "dev": true }, "core-js-compat": { - "version": "3.35.0", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.35.0.tgz", - "integrity": "sha512-5blwFAddknKeNgsjBzilkdQ0+YK8L1PfqPYq40NOYMYFSS38qj+hpTcLLWwpIwA2A5bje/x5jmVn2tzUMg9IVw==", + "version": "3.37.1", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.37.1.tgz", + "integrity": "sha512-9TNiImhKvQqSUkOvk/mMRZzOANTiEVC7WaBNhHcKM7x+/5E1l5NvsysR19zuDQScE8k+kfQXWRN3AtS/eOSHpg==", "dev": true, "requires": { - "browserslist": "^4.22.2" + "browserslist": "^4.23.0" } }, "core-util-is": { @@ -9493,9 +9411,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.4.630", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.630.tgz", - "integrity": "sha512-osHqhtjojpCsACVnuD11xO5g9xaCyw7Qqn/C2KParkMv42i8jrJJgx3g7mkHfpxwhy9MnOJr8+pKOdZ7qzgizg==", + "version": "1.4.818", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.818.tgz", + "integrity": "sha512-eGvIk2V0dGImV9gWLq8fDfTTsCAeMDwZqEPMr+jMInxZdnp9Us8UpovYpRCf9NQ7VOFgrN2doNSgvISbsbNpxA==", "dev": true }, "emittery": { @@ -9525,9 +9443,9 @@ } }, "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", + "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==" }, "escape-string-regexp": { "version": "1.0.5", @@ -9576,23 +9494,6 @@ "text-table": "^0.2.0" }, "dependencies": { - "@eslint/eslintrc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", - "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", - "dev": true, - "requires": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^10.0.1", - "globals": "^14.0.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - } - }, "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -9639,17 +9540,6 @@ "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", "dev": true }, - "espree": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.1.0.tgz", - "integrity": "sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==", - "dev": true, - "requires": { - "acorn": "^8.12.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.0.0" - } - }, "find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -9660,12 +9550,6 @@ "path-exists": "^4.0.0" } }, - "globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", - "dev": true - }, "is-path-inside": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", @@ -9708,12 +9592,6 @@ "ansi-regex": "^5.0.1" } }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true - }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -9749,17 +9627,17 @@ } }, "eslint-plugin-unicorn": { - "version": "51.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-51.0.1.tgz", - "integrity": "sha512-MuR/+9VuB0fydoI0nIn2RDA5WISRn4AsJyNSaNKLVwie9/ONvQhxOBbkfSICBPnzKrB77Fh6CZZXjgTt/4Latw==", + "version": "54.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-54.0.0.tgz", + "integrity": "sha512-XxYLRiYtAWiAjPv6z4JREby1TAE2byBC7wlh0V4vWDCpccOSU1KovWV//jqPXF6bq3WKxqX9rdjoRQ1EhdmNdQ==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.22.20", + "@babel/helper-validator-identifier": "^7.24.5", "@eslint-community/eslint-utils": "^4.4.0", - "@eslint/eslintrc": "^2.1.4", + "@eslint/eslintrc": "^3.0.2", "ci-info": "^4.0.0", "clean-regexp": "^1.0.0", - "core-js-compat": "^3.34.0", + "core-js-compat": "^3.37.0", "esquery": "^1.5.0", "indent-string": "^4.0.0", "is-builtin-module": "^3.2.1", @@ -9768,7 +9646,7 @@ "read-pkg-up": "^7.0.1", "regexp-tree": "^0.1.27", "regjsparser": "^0.10.0", - "semver": "^7.5.4", + "semver": "^7.6.1", "strip-indent": "^3.0.0" }, "dependencies": { @@ -9797,14 +9675,22 @@ "dev": true }, "espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.1.0.tgz", + "integrity": "sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==", "dev": true, "requires": { - "acorn": "^8.9.0", + "acorn": "^8.12.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" + "eslint-visitor-keys": "^4.0.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", + "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", + "dev": true + } } }, "esprima": { @@ -10210,13 +10096,10 @@ } }, "globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true }, "globby": { "version": "14.0.0", @@ -10871,15 +10754,6 @@ "tslib": "^2.0.3" } }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, "make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -11436,9 +11310,9 @@ "optional": true }, "picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", "dev": true }, "picomatch": { @@ -11832,13 +11706,10 @@ } }, "semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "dev": true }, "serialize-error": { "version": "7.0.1", @@ -12385,12 +12256,6 @@ "prelude-ls": "^1.2.1" } }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true - }, "typescript": { "version": "5.5.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", @@ -12426,13 +12291,13 @@ "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==" }, "update-browserslist-db": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", - "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", + "integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==", "dev": true, "requires": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" + "escalade": "^3.1.2", + "picocolors": "^1.0.1" } }, "update-check": { diff --git a/package.json b/package.json index 03e7d65468..91e27538cf 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "eslint": "9.6.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-prettier": "5.1.3", - "eslint-plugin-unicorn": "51.0.1", + "eslint-plugin-unicorn": "54.0.0", "jsdoc": "4.0.3", "prettier": "3.3.2", "serve": "14.2.3", diff --git a/test/commandtests/actionTest.js b/test/commandtests/actionTest.js index 85df045ea2..e155adcac6 100644 --- a/test/commandtests/actionTest.js +++ b/test/commandtests/actionTest.js @@ -1,6 +1,5 @@ import test from 'ava'; const { before, after, serial } = test; -import { resolve } from 'node:path'; import { getEngine } from '../util/engine.js'; import { startServer, stopServer } from '../util/httpserver.js'; import { fileURLToPath } from 'node:url'; @@ -12,7 +11,7 @@ const timeout = 20_000; let engine; function getPath(file) { - return resolve(__dirname, '..', 'data', 'commandscripts', file); + return path.resolve(__dirname, '..', 'data', 'commandscripts', file); } before('Setup the HTTP server', () => { diff --git a/test/commandtests/chromeTest.js b/test/commandtests/chromeTest.js index 0b1f8d97bc..9b05c7b897 100644 --- a/test/commandtests/chromeTest.js +++ b/test/commandtests/chromeTest.js @@ -1,6 +1,5 @@ import test from 'ava'; const { before, after, serial } = test; -import { resolve } from 'node:path'; import { getEngine } from '../util/engine.js'; import { startServer, stopServer } from '../util/httpserver.js'; import { fileURLToPath } from 'node:url'; @@ -12,7 +11,7 @@ const timeout = 20_000; let engine; function getPath(file) { - return resolve(__dirname, '..', 'data', 'commandscripts', file); + return path.resolve(__dirname, '..', 'data', 'commandscripts', file); } before('Setup the HTTP server', () => { diff --git a/test/commandtests/clickTest.js b/test/commandtests/clickTest.js index 850c27dcbe..be05e638fa 100644 --- a/test/commandtests/clickTest.js +++ b/test/commandtests/clickTest.js @@ -1,6 +1,5 @@ import test from 'ava'; const { before, after, serial } = test; -import { resolve } from 'node:path'; import { getEngine } from '../util/engine.js'; import { startServer, stopServer } from '../util/httpserver.js'; import { fileURLToPath } from 'node:url'; @@ -12,7 +11,7 @@ const timeout = 20_000; let engine; function getPath(file) { - return resolve(__dirname, '..', 'data', 'commandscripts', file); + return path.resolve(__dirname, '..', 'data', 'commandscripts', file); } before('Setup the HTTP server', () => { diff --git a/test/commandtests/firefoxTest.js b/test/commandtests/firefoxTest.js index 8debd10ac2..326d2d1fd4 100644 --- a/test/commandtests/firefoxTest.js +++ b/test/commandtests/firefoxTest.js @@ -1,6 +1,5 @@ import test from 'ava'; const { before, after, serial } = test; -import { resolve } from 'node:path'; import { getEngine } from '../util/engine.js'; import { startServer, stopServer } from '../util/httpserver.js'; import { fileURLToPath } from 'node:url'; @@ -12,7 +11,7 @@ const timeout = 20_000; let engine; function getPath(file) { - return resolve(__dirname, '..', 'data', 'commandscripts', file); + return path.resolve(__dirname, '..', 'data', 'commandscripts', file); } before('Setup the HTTP server', () => { diff --git a/test/commandtests/measureTest.js b/test/commandtests/measureTest.js index 98125e2993..df3790fd32 100644 --- a/test/commandtests/measureTest.js +++ b/test/commandtests/measureTest.js @@ -1,6 +1,5 @@ import test from 'ava'; const { before, after, serial } = test; -import { resolve } from 'node:path'; import { getEngine } from '../util/engine.js'; import { startServer, stopServer } from '../util/httpserver.js'; import { fileURLToPath } from 'node:url'; @@ -12,7 +11,7 @@ const timeout = 20_000; let engine; function getPath(file) { - return resolve(__dirname, '..', 'data', 'commandscripts', file); + return path.resolve(__dirname, '..', 'data', 'commandscripts', file); } before('Setup the HTTP server', () => { diff --git a/test/commandtests/miscTest.js b/test/commandtests/miscTest.js index 521e249185..4926e2cf82 100644 --- a/test/commandtests/miscTest.js +++ b/test/commandtests/miscTest.js @@ -1,6 +1,5 @@ import test from 'ava'; const { before, after, serial } = test; -import { resolve } from 'node:path'; import { getEngine } from '../util/engine.js'; import { startServer, stopServer } from '../util/httpserver.js'; import { fileURLToPath } from 'node:url'; @@ -12,7 +11,7 @@ const timeout = 20_000; let engine; function getPath(file) { - return resolve(__dirname, '..', 'data', 'commandscripts', file); + return path.resolve(__dirname, '..', 'data', 'commandscripts', file); } before('Setup the HTTP server', () => { diff --git a/test/commandtests/scrollTest.js b/test/commandtests/scrollTest.js index 8de52ad5f1..537385c06f 100644 --- a/test/commandtests/scrollTest.js +++ b/test/commandtests/scrollTest.js @@ -1,6 +1,5 @@ import test from 'ava'; const { before, after, serial } = test; -import { resolve } from 'node:path'; import { getEngine } from '../util/engine.js'; import { startServer, stopServer } from '../util/httpserver.js'; import { fileURLToPath } from 'node:url'; @@ -12,7 +11,7 @@ const timeout = 20_000; let engine; function getPath(file) { - return resolve(__dirname, '..', 'data', 'commandscripts', file); + return path.resolve(__dirname, '..', 'data', 'commandscripts', file); } before('Setup the HTTP server', () => { diff --git a/test/commandtests/stopWatch.js b/test/commandtests/stopWatch.js index 49f2906dd1..fa5a6fff07 100644 --- a/test/commandtests/stopWatch.js +++ b/test/commandtests/stopWatch.js @@ -1,6 +1,5 @@ import test from 'ava'; const { before, after, serial } = test; -import { resolve } from 'node:path'; import { getEngine } from '../util/engine.js'; import { startServer, stopServer } from '../util/httpserver.js'; import { fileURLToPath } from 'node:url'; @@ -12,7 +11,7 @@ const timeout = 20_000; let engine; function getPath(file) { - return resolve(__dirname, '..', 'data', 'commandscripts', file); + return path.resolve(__dirname, '..', 'data', 'commandscripts', file); } before('Setup the HTTP server', () => { diff --git a/test/commandtests/unified.js b/test/commandtests/unified.js index 1096d79362..18ff6481bf 100644 --- a/test/commandtests/unified.js +++ b/test/commandtests/unified.js @@ -1,6 +1,5 @@ import test from 'ava'; const { before, after, serial } = test; -import { resolve } from 'node:path'; import { getEngine } from '../util/engine.js'; import { startServer, stopServer } from '../util/httpserver.js'; import { fileURLToPath } from 'node:url'; @@ -12,7 +11,7 @@ const timeout = 20_000; let engine; function getPath(file) { - return resolve(__dirname, '..', 'data', 'commandscripts', file); + return path.resolve(__dirname, '..', 'data', 'commandscripts', file); } before('Setup the HTTP server', () => { diff --git a/test/engineTest.js b/test/engineTest.js index 874fcdb296..faa89ce8ed 100644 --- a/test/engineTest.js +++ b/test/engineTest.js @@ -1,6 +1,5 @@ import test from 'ava'; const { before, after, serial, afterEach } = test; -import { resolve } from 'node:path'; const timeout = 20_000; import { startServer, stopServer } from './util/httpserver.js'; import { getEngine } from './util/engine.js'; @@ -143,7 +142,7 @@ serial(`Load multiple URLs`, async t => { }); function loadTaskFile(file) { - return require(resolve(__dirname, 'data', 'prepostscripts', file)); + return require(path.resolve(__dirname, 'data', 'prepostscripts', file)); } serial(`Use pre/post scripts`, async t => { diff --git a/test/unittests/browserScriptsTest.js b/test/unittests/browserScriptsTest.js index 35907e6de6..f01bb82e07 100644 --- a/test/unittests/browserScriptsTest.js +++ b/test/unittests/browserScriptsTest.js @@ -1,5 +1,4 @@ import test from 'ava'; -import { resolve } from 'node:path'; import { findAndParseScripts, allScriptCategories, @@ -9,7 +8,7 @@ import { fileURLToPath } from 'node:url'; import path from 'node:path'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const TEST_SCRIPTS_FOLDER = resolve( +const TEST_SCRIPTS_FOLDER = path.resolve( __dirname, '..', 'data', diff --git a/test/unittests/userTimingTest.js b/test/unittests/userTimingTest.js index fc9119b4e2..4ea857e1e1 100644 --- a/test/unittests/userTimingTest.js +++ b/test/unittests/userTimingTest.js @@ -1,12 +1,11 @@ import test from 'ava'; -import { resolve } from 'node:path'; import { filterAllowlisted } from '../../lib/support/userTiming.js'; import { readFileSync } from 'node:fs'; import { fileURLToPath } from 'node:url'; import path from 'node:path'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const timingsFile = resolve(__dirname, '..', 'data', 'timings.json'); +const timingsFile = path.resolve(__dirname, '..', 'data', 'timings.json'); test(`Filter white listed user timings`, async t => { const userTimings = JSON.parse(readFileSync(timingsFile, 'utf8')).timings