Skip to content

Commit

Permalink
fix: do not log non-migration files (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmkal authored and SimonSchick committed Jun 12, 2019
1 parent ebb08d6 commit cdfd53e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ module.exports = class Umzug extends EventEmitter {
if (this.options.migrations.pattern.test(file)) {
return new Migration(filePath, this.options);
}
this.log('File: ' + file + ' does not match pattern: ' + this.options.migrations.pattern);
return file;
})
.reduce((a, b) => a.concat(b), []) // flatten the result to an array
Expand Down
14 changes: 6 additions & 8 deletions test/Umzug/execute.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,9 @@ describe('execute', () => {
.then(() => {
expect(this.upStub.callCount).to.equal(1);
expect(this.downStub.callCount).to.equal(0);
expect(this.logSpy.callCount).to.equal(3);
expect(this.logSpy.getCall(0).args[0]).to.match(/File: \.gitkeep does not match pattern: .+/);
expect(this.logSpy.getCall(1).args[0]).to.equal('== 123-migration: migrating =======');
expect(this.logSpy.getCall(2).args[0]).to.match(/== 123-migration: migrated \(0\.0\d\ds\)/);
expect(this.logSpy.callCount).to.equal(2);
expect(this.logSpy.getCall(0).args[0]).to.equal('== 123-migration: migrating =======');
expect(this.logSpy.getCall(1).args[0]).to.match(/== 123-migration: migrated \(0\.0\d\ds\)/);
expect(this.migratingEventSpy.calledWith('123-migration')).to.equal(true);
expect(this.migratedEventSpy.calledWith('123-migration')).to.equal(true);
});
Expand All @@ -84,10 +83,9 @@ describe('execute', () => {
.then(() => {
expect(this.upStub.callCount).to.equal(0);
expect(this.downStub.callCount).to.equal(1);
expect(this.logSpy.callCount).to.equal(3);
expect(this.logSpy.getCall(0).args[0]).to.match(/File: \.gitkeep does not match pattern: .+/);
expect(this.logSpy.getCall(1).args[0]).to.equal('== 123-migration: reverting =======');
expect(this.logSpy.getCall(2).args[0]).to.match(/== 123-migration: reverted \(0\.0\d\ds\)/);
expect(this.logSpy.callCount).to.equal(2);
expect(this.logSpy.getCall(0).args[0]).to.equal('== 123-migration: reverting =======');
expect(this.logSpy.getCall(1).args[0]).to.match(/== 123-migration: reverted \(0\.0\d\ds\)/);
expect(this.revertingEventSpy.calledWith('123-migration')).to.equal(true);
expect(this.revertedEventSpy.calledWith('123-migration')).to.equal(true);
});
Expand Down

0 comments on commit cdfd53e

Please sign in to comment.