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