Skip to content

Commit

Permalink
Fix coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
j0k3r committed Apr 12, 2021
1 parent ecb23f2 commit 50b9510
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/packageModules.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,54 @@ describe('packageModules', () => {
module.compileStats = stats;
return expect(module.packageModules()).to.be.rejectedWith('Packaging: No files found');
});

it('should reject only .md files without verbose log', () => {
module.options.verbose = false;
module.configuration = new Configuration({
webpack: {
excludeRegex: '.md$'
}
});

// Test data
const stats = {
stats: [
{
compilation: {
compiler: {
outputPath: '/my/Service/Path/.webpack/service'
}
}
}
]
};
const files = [ 'README.md', 'src/handler1.js', 'src/handler1.js.map', 'src/handler2.js', 'src/handler2.js.map' ];
const allFunctions = [ 'func1', 'func2' ];
const func1 = {
handler: 'src/handler1',
events: []
};
const func2 = {
handler: 'src/handler2',
events: []
};
// Serverless behavior
getVersionStub.returns('1.18.0');
getServiceObjectStub.returns({
name: 'test-service'
});
getAllFunctionsStub.returns(allFunctions);
getFunctionStub.withArgs('func1').returns(func1);
getFunctionStub.withArgs('func2').returns(func2);
// Mock behavior
globMock.sync.returns(files);
fsMock._streamMock.on.withArgs('open').yields();
fsMock._streamMock.on.withArgs('close').yields();
fsMock._statMock.isDirectory.returns(false);

module.compileStats = stats;
return expect(module.packageModules()).to.be.fulfilled;
});
});

describe('with individual packaging', () => {
Expand Down

0 comments on commit 50b9510

Please sign in to comment.