deadbyte-mcp 0.15.62 → 0.15.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import test from 'node:test';
2
2
  import assert from 'node:assert/strict';
3
3
  import {spawnSync} from 'node:child_process';
4
- import {mkdtemp,rm,readFile} from 'node:fs/promises';
4
+ import {mkdtemp,mkdir,rm,readFile,writeFile} from 'node:fs/promises';
5
5
  import os from 'node:os';
6
6
  import path from 'node:path';
7
7
  import {fileURLToPath} from 'node:url';
@@ -22,16 +22,36 @@ test('repository compatibility CMD refuses to masquerade as an exact npm package
22
22
  assert.doesNotMatch(run.stderr,/deadbyte-controller\.ps1/);
23
23
  });
24
24
 
25
- test('isolated exact local tarball invocation reaches its package bin outside the source tree', {skip:process.platform!=='win32',timeout:120000},async()=>{
25
+ test('isolated exact local tarball install reaches its package bin outside the source tree', {skip:process.platform!=='win32',timeout:120000},async()=>{
26
26
  const fixture=await mkdtemp(path.join(os.tmpdir(),'deadbyte-r65-cli-package-'));
27
27
  try{
28
- const npmCli=process.env.npm_execpath||path.join(path.dirname(process.execPath),'node_modules','npm','bin','npm-cli.js');
28
+ const packDir=path.join(fixture,'pack');
29
+ const installDir=path.join(fixture,'install');
30
+ const tempDir=path.join(fixture,'temp');
31
+ await mkdir(packDir);
32
+ await mkdir(installDir);
33
+ await mkdir(tempDir);
34
+ await writeFile(path.join(installDir,'package.json'),'{"private":true}\n',{encoding:'utf8',flag:'wx'});
35
+ const npmCli=path.join(path.dirname(process.execPath),'node_modules','npm','bin','npm-cli.js');
36
+ const nodePath=path.dirname(process.execPath);
37
+ const systemRoot=process.env.SystemRoot??process.env.WINDIR??'C:\\Windows';
38
+ const npmEnv={
39
+ SystemRoot:systemRoot,WINDIR:systemRoot,TEMP:tempDir,TMP:tempDir,
40
+ USERPROFILE:process.env.USERPROFILE??os.homedir(),
41
+ ComSpec:process.env.ComSpec??path.join(systemRoot,'System32','cmd.exe'),
42
+ PATH:[nodePath,path.join(systemRoot,'System32')].join(path.delimiter),
43
+ PATHEXT:'.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC',
44
+ npm_config_cache:path.join(fixture,'npm-cache')};
29
45
  const pkg=JSON.parse(await readFile(path.join(root,'package.json'),'utf8'));
30
- const pack=spawnSync(process.execPath,[npmCli,'pack','--json','--pack-destination',fixture],{cwd:root,encoding:'utf8',timeout:45000,windowsHide:true});
46
+ const pack=spawnSync(process.execPath,[npmCli,'pack','--json','--pack-destination',packDir],{cwd:root,env:npmEnv,encoding:'utf8',timeout:45000,windowsHide:true});
31
47
  assert.equal(pack.status,0,(pack.stderr||'').slice(-1000));
32
- const packed=JSON.parse(pack.stdout);const tarball=path.join(fixture,packed[0]?.filename??packed['deadbyte-mcp']?.filename);
33
- const run=spawnSync(process.execPath,[npmCli,'exec','--offline','--yes',`--package=file:${tarball}`,'--','deadbyte-mcp','--version'],{
34
- cwd:fixture,encoding:'utf8',timeout:60000,windowsHide:true});
48
+ const packed=JSON.parse(pack.stdout);const tarball=path.join(packDir,packed[0]?.filename??packed['deadbyte-mcp']?.filename);
49
+ const install=spawnSync(process.execPath,[npmCli,'install','--offline','--ignore-scripts','--no-audit','--no-fund',tarball],{
50
+ cwd:installDir,env:npmEnv,encoding:'utf8',timeout:60000,windowsHide:true});
51
+ assert.equal(install.status,0,(install.stderr||'').slice(-1000));
52
+ const packageBin=path.join(installDir,'node_modules','.bin','deadbyte-mcp.cmd');
53
+ const run=spawnSync(process.env.ComSpec||'C:\\Windows\\System32\\cmd.exe',['/d','/c',packageBin,'--version'],{
54
+ cwd:installDir,env:npmEnv,encoding:'utf8',timeout:30000,windowsHide:true});
35
55
  assert.equal(run.status,0,(run.stderr||'').slice(-1000));
36
56
  assert.equal(run.stdout.trim(),pkg.version);
37
57
  }finally{await rm(fixture,{recursive:true,force:true});}