Skip to content

Commit

Permalink
huh. copyFileSync is newisH/
Browse files Browse the repository at this point in the history
  • Loading branch information
dschep committed May 22, 2019
1 parent 60c422e commit c6380b0
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions tests/packaging-suite/packaging.tests.js
Expand Up @@ -16,8 +16,8 @@ describe('Integration test - Packaging', () => {
});

it('packages the default aws template correctly in the zip', () => {
fs.copyFileSync(path.join(__dirname, 'serverless.yml'), path.join(cwd, 'serverless.yml'))
fs.copyFileSync(path.join(__dirname, 'handler.js'), path.join(cwd, 'handler.js'))
fse.copyFileSync(path.join(__dirname, 'serverless.yml'), path.join(cwd, 'serverless.yml'))
fse.copyFileSync(path.join(__dirname, 'handler.js'), path.join(cwd, 'handler.js'))
execSync(`${serverlessExec} package`, { cwd });
return testUtils.listZipFiles(path.join(cwd, '.serverless/aws-nodejs.zip'))
.then(zipfiles => {
Expand All @@ -26,8 +26,8 @@ describe('Integration test - Packaging', () => {
});

it('packages the default aws template with an npm dep correctly in the zip', () => {
fs.copyFileSync(path.join(__dirname, 'serverless.yml'), path.join(cwd, 'serverless.yml'))
fs.copyFileSync(path.join(__dirname, 'handler.js'), path.join(cwd, 'handler.js'))
fse.copyFileSync(path.join(__dirname, 'serverless.yml'), path.join(cwd, 'serverless.yml'))
fse.copyFileSync(path.join(__dirname, 'handler.js'), path.join(cwd, 'handler.js'))
execSync('npm init --yes', { cwd });
execSync('npm i lodash', { cwd });
execSync(`${serverlessExec} package`, { cwd });
Expand All @@ -42,8 +42,8 @@ describe('Integration test - Packaging', () => {
});

it('doesn\'t package a dev dependency in the zip', () => {
fs.copyFileSync(path.join(__dirname, 'serverless.yml'), path.join(cwd, 'serverless.yml'))
fs.copyFileSync(path.join(__dirname, 'handler.js'), path.join(cwd, 'handler.js'))
fse.copyFileSync(path.join(__dirname, 'serverless.yml'), path.join(cwd, 'serverless.yml'))
fse.copyFileSync(path.join(__dirname, 'handler.js'), path.join(cwd, 'handler.js'))
execSync('npm init --yes', { cwd });
execSync('npm i --save-dev lodash', { cwd });
execSync(`${serverlessExec} package`, { cwd });
Expand All @@ -58,8 +58,8 @@ describe('Integration test - Packaging', () => {
});

it('ignores package json files per ignore directive in the zip', () => {
fs.copyFileSync(path.join(__dirname, 'serverless.yml'), path.join(cwd, 'serverless.yml'))
fs.copyFileSync(path.join(__dirname, 'handler.js'), path.join(cwd, 'handler.js'))
fse.copyFileSync(path.join(__dirname, 'serverless.yml'), path.join(cwd, 'serverless.yml'))
fse.copyFileSync(path.join(__dirname, 'handler.js'), path.join(cwd, 'handler.js'))
execSync('npm init --yes', { cwd });
execSync('echo \'package: {exclude: ["package*.json"]}\' >> serverless.yml', { cwd });
execSync('npm i lodash', { cwd });
Expand All @@ -75,8 +75,8 @@ describe('Integration test - Packaging', () => {
});

it('package artifact directive works', () => {
fs.copyFileSync(path.join(__dirname, 'serverless.yml'), path.join(cwd, 'serverless.yml'))
fs.copyFileSync(path.join(__dirname, 'artifact.zip'), path.join(cwd, 'artifact.zip'))
fse.copyFileSync(path.join(__dirname, 'serverless.yml'), path.join(cwd, 'serverless.yml'))
fse.copyFileSync(path.join(__dirname, 'artifact.zip'), path.join(cwd, 'artifact.zip'))
execSync('echo \'package: {artifact: artifact.zip}\' >> serverless.yml', { cwd });
execSync(`${serverlessExec} package`, { cwd });
const cfnTemplate = JSON.parse(fs.readFileSync(path.join(
Expand Down Expand Up @@ -112,8 +112,8 @@ describe('Integration test - Packaging', () => {
});

it('creates the correct default function resource in cfn template', () => {
fs.copyFileSync(path.join(__dirname, 'serverless.yml'), path.join(cwd, 'serverless.yml'))
fs.copyFileSync(path.join(__dirname, 'handler.js'), path.join(cwd, 'handler.js'))
fse.copyFileSync(path.join(__dirname, 'serverless.yml'), path.join(cwd, 'serverless.yml'))
fse.copyFileSync(path.join(__dirname, 'handler.js'), path.join(cwd, 'handler.js'))
execSync(`${serverlessExec} package`, { cwd });
const cfnTemplate = JSON.parse(fs.readFileSync(path.join(
cwd, '.serverless/cloudformation-template-update-stack.json')));
Expand Down Expand Up @@ -152,9 +152,9 @@ describe('Integration test - Packaging', () => {
});

it('handles package individually with include/excludes correctly', () => {
fs.copyFileSync(path.join(__dirname, 'individually.yml'), path.join(cwd, 'serverless.yml'))
fs.copyFileSync(path.join(__dirname, 'handler.js'), path.join(cwd, 'handler.js'))
fs.copyFileSync(path.join(__dirname, 'handler2.js'), path.join(cwd, 'handler2.js'))
fse.copyFileSync(path.join(__dirname, 'individually.yml'), path.join(cwd, 'serverless.yml'))
fse.copyFileSync(path.join(__dirname, 'handler.js'), path.join(cwd, 'handler.js'))
fse.copyFileSync(path.join(__dirname, 'handler2.js'), path.join(cwd, 'handler2.js'))
execSync(`${serverlessExec} package`, { cwd });
const cfnTemplate = JSON.parse(fs.readFileSync(path.join(
cwd, '.serverless/cloudformation-template-update-stack.json')));
Expand Down

0 comments on commit c6380b0

Please sign in to comment.