diff --git a/lib/util/transform.js b/lib/util/transform.js index 44b83d37..337cc6a0 100644 --- a/lib/util/transform.js +++ b/lib/util/transform.js @@ -5,6 +5,7 @@ const findUp = require('find-up'); const minimatch = require('minimatch'); const {transform, passthrough, filter} = require('p-transform'); const OOOTransform = require('./out-of-order-transform'); +const {clearFileState} = require('mem-fs-editor/lib/state.js'); const {Minimatch} = minimatch; @@ -198,8 +199,7 @@ function createConflicterStatusTransform() { } if (action === 'skip') { - delete file.state; - delete file.isNew; + clearFileState(file); return undefined; } return file; diff --git a/test/transform.js b/test/transform.js index 9d866dbe..26363f8e 100644 --- a/test/transform.js +++ b/test/transform.js @@ -206,6 +206,12 @@ describe('Transform stream', () => { assert.equal(file.conflicterLog, undefined); } }); + + it('should clear the state of skipped file', () => { + assert.equal(conflicterSkippedFile.state, undefined); + assert.equal(conflicterSkippedFile.isNew, undefined); + assert.equal(conflicterSkippedFile.stateCleared, 'modified'); + }); }); describe('getConflicterStatusForFile()', () => {