Browse Source

chore: add spec for --inspect after a -- (#15237)

Samuel Attard 6 years ago
parent
commit
f02f9ba9fb
2 changed files with 19 additions and 0 deletions
  1. 1 0
      spec/fixtures/module/noop.js
  2. 18 0
      spec/node-spec.js

+ 1 - 0
spec/fixtures/module/noop.js

@@ -0,0 +1 @@
+process.exit(0)

+ 18 - 0
spec/node-spec.js

@@ -239,6 +239,24 @@ describe('node feature', () => {
       child.stdout.on('data', outDataHandler)
     })
 
+    it('does not start the v8 inspector when --inspect is after a -- argument', (done) => {
+      child = ChildProcess.spawn(remote.process.execPath, [path.join(__dirname, 'fixtures', 'module', 'noop.js'), '--', '--inspect'])
+
+      let output = ''
+      function dataListener (data) {
+        output += data
+      }
+      child.stderr.on('data', dataListener)
+      child.stdout.on('data', dataListener)
+      child.on('exit', () => {
+        if (output.trim().startsWith('Debugger listening on ws://')) {
+          done(new Error('Inspector was started when it should not have been'))
+        } else {
+          done()
+        }
+      })
+    })
+
     it('supports js binding', (done) => {
       child = ChildProcess.spawn(process.execPath, ['--inspect', path.join(__dirname, 'fixtures', 'module', 'inspector-binding.js')], {
         env: {