Browse Source

test: add test for nodeCliInspect fuse (#43035)

David Sanders 8 months ago
parent
commit
f979d4c742
1 changed files with 8 additions and 1 deletions
  1. 8 1
      spec/fuses-spec.ts

+ 8 - 1
spec/fuses-spec.ts

@@ -1,7 +1,7 @@
 import { expect } from 'chai';
 import { startRemoteControlApp } from './lib/spec-helpers';
 import { once } from 'node:events';
-import { spawn } from 'node:child_process';
+import { spawn, spawnSync } from 'node:child_process';
 import { BrowserWindow } from 'electron';
 import path = require('node:path');
 
@@ -17,6 +17,13 @@ describe('fuses', () => {
     expect(code1).to.equal(0);
   });
 
+  it('disables --inspect flag when node_cli_inspect is 0', () => {
+    const { status, stderr } = spawnSync(process.execPath, ['--set-fuse-node_cli_inspect=0', '--inspect', '-v'], { encoding: 'utf-8' });
+    expect(stderr).to.not.include('Debugger listening on ws://');
+    // Should print the version and exit with 0
+    expect(status).to.equal(0);
+  });
+
   it('disables fetching file:// URLs when grant_file_protocol_extra_privileges is 0', async () => {
     const rc = await startRemoteControlApp(['--set-fuse-grant_file_protocol_extra_privileges=0']);
     await expect(rc.remotely(async (fixture: string) => {