 
       out.on 'connect', ->
         received.push 'CONN'
+        return
       out.on 'begingroup', (group) ->
         received.push "< #{group}"
+        return
       out.on 'data', (data) ->
         received.push "DATA #{data}"
+        return
       out.on 'endgroup', ->
         received.push '>'
+        return
       out.on 'disconnect', ->
         received.push 'DISC'
         chai.expect(received).to.eql expected
         done()
+        return
 
       in2.connect()
       in2.send 'foo'


    output.sendDone
      out: "1#{first}:2#{second0}:2#{second1}:#{c.nodeId}"

describe 'Scope isolation', ->
  loader = null
  before (done) ->
    loader = new noflo.ComponentLoader root
    loader.listComponents (err) ->
      return done err if err
      loader.registerComponent 'process', 'Async', processAsync
      loader.registerComponent 'process', 'Merge', processMerge
      loader.registerComponent 'process', 'MergeA', processMergeA
      loader.registerComponent 'process', 'Unscope', processUnscope
      loader.registerComponent 'process', 'MergeUnscoped', processMergeUnscoped
      done()

  describe 'pure Process API merging two inputs', ->
    c = null
    in1 = null

      'twoIIP' -> IN2 PcMerge(process/Merge)
      "
      noflo.graph.loadFBP fbpData, (err, g) ->
        if err
          done err
          return
        loader.registerComponent 'scope', 'MergeIIP', g
        loader.load 'scope/MergeIIP', (err, instance) ->
          if err
            done err
            return
          c = instance
          in1 = noflo.internalSocket.createSocket()
          c.inPorts.in1.attach in1
          c.setUp done
          return
        return
      return
    beforeEach ->
      out = noflo.internalSocket.createSocket()
      c.outPorts.out.attach out
      return
    afterEach ->
      c.outPorts.out.detach out
      out = null

      return
    it 'should forward scopes as expected', (done) ->
      expected = [
        'x < 1'
