mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-04-09 16:19:25 -07:00
fix: stabilize windows-specific tests on linux ci
This commit is contained in:
@@ -96,7 +96,10 @@ test('installFirstRunPluginToDefaultLocation installs plugin and backs up existi
|
||||
});
|
||||
});
|
||||
|
||||
test('installFirstRunPluginToDefaultLocation installs plugin to Windows mpv defaults', () => {
|
||||
test(
|
||||
'installFirstRunPluginToDefaultLocation installs plugin to Windows mpv defaults',
|
||||
{ skip: process.platform !== 'win32' },
|
||||
() => {
|
||||
withTempDir((root) => {
|
||||
const resourcesPath = path.join(root, 'resources');
|
||||
const pluginRoot = path.join(resourcesPath, 'plugin');
|
||||
@@ -127,9 +130,13 @@ test('installFirstRunPluginToDefaultLocation installs plugin to Windows mpv defa
|
||||
'configured=true\n',
|
||||
);
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
test('installFirstRunPluginToDefaultLocation rewrites Windows plugin socket_path', () => {
|
||||
test(
|
||||
'installFirstRunPluginToDefaultLocation rewrites Windows plugin socket_path',
|
||||
{ skip: process.platform !== 'win32' },
|
||||
() => {
|
||||
withTempDir((root) => {
|
||||
const resourcesPath = path.join(root, 'resources');
|
||||
const pluginRoot = path.join(resourcesPath, 'plugin');
|
||||
@@ -157,4 +164,5 @@ test('installFirstRunPluginToDefaultLocation rewrites Windows plugin socket_path
|
||||
'binary_path=\nsocket_path=\\\\.\\pipe\\subminer-socket\n',
|
||||
);
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
@@ -44,6 +44,8 @@ type ResolveWindowsTrackerHelperOptions = {
|
||||
copyFileSync?: (source: string, destination: string) => void;
|
||||
};
|
||||
|
||||
const windowsPath = path.win32;
|
||||
|
||||
function normalizeHelperMode(value: string | undefined): WindowsTrackerHelperMode {
|
||||
const normalized = value?.trim().toLowerCase();
|
||||
if (normalized === 'powershell' || normalized === 'native') {
|
||||
@@ -72,8 +74,8 @@ function materializeAsarHelper(
|
||||
|
||||
const fileName =
|
||||
kind === 'native' ? 'get-mpv-window-windows.exe' : 'get-mpv-window-windows.ps1';
|
||||
const targetDir = path.join(os.tmpdir(), 'subminer', 'helpers');
|
||||
const targetPath = path.join(targetDir, fileName);
|
||||
const targetDir = windowsPath.join(os.tmpdir(), 'subminer', 'helpers');
|
||||
const targetPath = windowsPath.join(targetDir, fileName);
|
||||
|
||||
try {
|
||||
deps.mkdirSync(targetDir, { recursive: true });
|
||||
@@ -137,29 +139,29 @@ function getHelperCandidates(dirname: string, resourcesPath: string | undefined)
|
||||
|
||||
if (resourcesPath) {
|
||||
candidates.push({
|
||||
path: path.join(resourcesPath, 'scripts', `${scriptFileBase}.exe`),
|
||||
path: windowsPath.join(resourcesPath, 'scripts', `${scriptFileBase}.exe`),
|
||||
kind: 'native',
|
||||
});
|
||||
candidates.push({
|
||||
path: path.join(resourcesPath, 'scripts', `${scriptFileBase}.ps1`),
|
||||
path: windowsPath.join(resourcesPath, 'scripts', `${scriptFileBase}.ps1`),
|
||||
kind: 'powershell',
|
||||
});
|
||||
}
|
||||
|
||||
candidates.push({
|
||||
path: path.join(dirname, '..', 'scripts', `${scriptFileBase}.exe`),
|
||||
path: windowsPath.join(dirname, '..', 'scripts', `${scriptFileBase}.exe`),
|
||||
kind: 'native',
|
||||
});
|
||||
candidates.push({
|
||||
path: path.join(dirname, '..', 'scripts', `${scriptFileBase}.ps1`),
|
||||
path: windowsPath.join(dirname, '..', 'scripts', `${scriptFileBase}.ps1`),
|
||||
kind: 'powershell',
|
||||
});
|
||||
candidates.push({
|
||||
path: path.join(dirname, '..', '..', 'scripts', `${scriptFileBase}.exe`),
|
||||
path: windowsPath.join(dirname, '..', '..', 'scripts', `${scriptFileBase}.exe`),
|
||||
kind: 'native',
|
||||
});
|
||||
candidates.push({
|
||||
path: path.join(dirname, '..', '..', 'scripts', `${scriptFileBase}.ps1`),
|
||||
path: windowsPath.join(dirname, '..', '..', 'scripts', `${scriptFileBase}.ps1`),
|
||||
kind: 'powershell',
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user