From 3d0c7298accd194178c17a977790510a37559c18 Mon Sep 17 00:00:00 2001 From: soulgalore Date: Tue, 19 Dec 2023 16:33:46 +0100 Subject: [PATCH 1/3] Add check for Windows long paths --- lib/core/engine/index.js | 4 ++++ lib/support/window.js | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 lib/support/window.js diff --git a/lib/core/engine/index.js b/lib/core/engine/index.js index 079f1485b..f6f95ccb3 100644 --- a/lib/core/engine/index.js +++ b/lib/core/engine/index.js @@ -31,6 +31,9 @@ import { loadScript, loadPageCompleteScript } from '../../support/engineUtils.js'; + +import { checkWindowsLongPath } from '../../support/windows.js'; + const log = intel.getLogger('browsertime'); const defaults = { scripts: [], @@ -283,6 +286,7 @@ export class Engine { options ); + await checkWindowsLongPath(); await storageManager.createDataDir(); await engineDelegate.beforeBrowserStart(name, options); const collector = new Collector(name, storageManager, options); diff --git a/lib/support/window.js b/lib/support/window.js new file mode 100644 index 000000000..869c02ad5 --- /dev/null +++ b/lib/support/window.js @@ -0,0 +1,20 @@ +import { execa } from 'execa'; + +import intel from 'intel'; +const log = intel.getLogger('browsertime'); + +export async function checkWindowsLongPath() { + if (process.platform === 'win32') { + const { stdout } = await execa( + '(Get-ItemProperty "HKLM:System\\CurrentControlSet\\Control\\FileSystem").LongPathsEnabled', + { + shell: 'powershell.exe' + } + ); + if (stdout === '1') { + log.info('LongPaths is enabled'); + } else if (stdout === '0') { + log.info('LongPaths is not enabled'); + } + } +} From 50903ecd2d658fcf80fe5ce4b8d955922af09ea2 Mon Sep 17 00:00:00 2001 From: soulgalore Date: Tue, 19 Dec 2023 16:39:01 +0100 Subject: [PATCH 2/3] fix --- lib/support/{window.js => windows.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lib/support/{window.js => windows.js} (100%) diff --git a/lib/support/window.js b/lib/support/windows.js similarity index 100% rename from lib/support/window.js rename to lib/support/windows.js From 1471d26caddcb31ee17a69d1094eccea604ef34e Mon Sep 17 00:00:00 2001 From: soulgalore Date: Wed, 20 Dec 2023 04:01:47 +0100 Subject: [PATCH 3/3] better text --- lib/support/windows.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/support/windows.js b/lib/support/windows.js index 869c02ad5..cce265ceb 100644 --- a/lib/support/windows.js +++ b/lib/support/windows.js @@ -11,10 +11,10 @@ export async function checkWindowsLongPath() { shell: 'powershell.exe' } ); - if (stdout === '1') { - log.info('LongPaths is enabled'); - } else if (stdout === '0') { - log.info('LongPaths is not enabled'); + if (stdout === '0') { + log.info( + 'LongPaths is not enabled and that can make testing fail. Read https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry on how to enable long paths' + ); } } }