var parser = require(__dirname).test({ expect: [ ['opentag', {'name':'T', attributes:{}, isSelfClosing: false}], ['text', 'flush'], ['text', 'rest'], ['closetag', 'T'], ] }); parser.write('flush'); parser.flush(); parser.write('rest'); parser.close();