mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
Update the hook order because the functions need the .zip file in their resource definition. Furthermore the zipping process / writing it to disc was optimized. The ".serverless" directory is also added to the "default exclude array" so that it's not considered during packaging.
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
const expect = require('chai').expect;
|
|
const os = require('os');
|
|
const path = require('path');
|
|
const Package = require('../index');
|
|
const Serverless = require('../../../../lib/Serverless');
|
|
|
|
describe('#cleanup()', () => {
|
|
let serverless;
|
|
let packageService;
|
|
|
|
beforeEach(() => {
|
|
serverless = new Serverless();
|
|
packageService = new Package(serverless);
|
|
|
|
serverless.config.servicePath = path.join(os.tmpdir(), (new Date).getTime().toString());
|
|
});
|
|
|
|
it('should remove .serverless in the service directory', () => {
|
|
const serverlessTmpDirPath = path.join(packageService.serverless.config.servicePath,
|
|
'.serverless', 'README');
|
|
serverless.utils.writeFileSync(serverlessTmpDirPath,
|
|
'Some README content');
|
|
|
|
return packageService.cleanup().then(() => {
|
|
expect(serverless.utils.dirExistsSync(path.join(packageService.serverless.config.servicePath,
|
|
'.serverless'))).to.equal(false);
|
|
});
|
|
});
|
|
|
|
it('should resolve if the .serverless directory is not present', (done) => packageService
|
|
.cleanup().then(() => {
|
|
done();
|
|
})
|
|
);
|
|
});
|