Skip to content

Commit

Permalink
add tests for keepOutputDirectory option
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydp17 committed Jan 4, 2019
1 parent dfe4a10 commit f53b9ea
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/Configuration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('Configuration', () => {
includeModules: false,
packager: 'npm',
packagerOptions: {},
keepOutputDirectory: false,
config: null
};
});
Expand Down Expand Up @@ -66,6 +67,7 @@ describe('Configuration', () => {
includeModules: { forceInclude: ['mod1'] },
packager: 'npm',
packagerOptions: {},
keepOutputDirectory: false,
config: null
});
});
Expand All @@ -85,6 +87,7 @@ describe('Configuration', () => {
includeModules: { forceInclude: ['mod1'] },
packager: 'npm',
packagerOptions: {},
keepOutputDirectory: false,
config: null
});
});
Expand All @@ -103,6 +106,7 @@ describe('Configuration', () => {
includeModules: { forceInclude: ['mod1'] },
packager: 'npm',
packagerOptions: {},
keepOutputDirectory: false,
config: null
});
});
Expand Down
18 changes: 17 additions & 1 deletion tests/cleanup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ describe('cleanup', () => {
module = _.assign({
serverless,
options: {},
webpackOutputPath: 'my/Output/Path'
webpackOutputPath: 'my/Output/Path',
configuration: {}
}, baseModule);
});

Expand Down Expand Up @@ -88,4 +89,19 @@ describe('cleanup', () => {
return null;
});
});

it('should keep output dir if keepOutputDir = true', () => {
dirExistsSyncStub.returns(true);
fseMock.removeSync.reset();

const configuredModule = _.assign({}, module, {
configuration: { keepOutputDirectory: true }
});
return expect(configuredModule.cleanup()).to.be.fulfilled
.then(() => {
expect(dirExistsSyncStub).to.not.have.been.calledOnce;
expect(fseMock.removeSync).to.not.have.been.called;
return null;
});
})
});

0 comments on commit f53b9ea

Please sign in to comment.