Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Add smoke tests #361

Merged
merged 6 commits into from
Sep 25, 2018
Merged

Add smoke tests #361

merged 6 commits into from
Sep 25, 2018

Conversation

eliangcs
Copy link
Member

@eliangcs eliangcs commented Sep 21, 2018

"Smoke tests" - these are some sanity tests I've been doing manually every time I release a new version of the npm package. This is to make sure there're no mistakes during packaging, which can't be captured in unit tests. Let's automate these smoke tests so we can be more confident about releasing.

Going to do the same to core and schema as well.

@eliangcs eliangcs requested a review from xavdid September 21, 2018 11:44
};

before(() => {
if (process.env.DEPLOY_KEY) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEPLOY_KEY is already configured on Travis and it associates to a test account I created on Zapier.com.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool! is that anywhere in 1P or somewhere others will be able to access it?

Copy link
Member Author

@eliangcs eliangcs Sep 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! You can find it in 1P. The account is [email protected]. The deploy key can be found there in the Form Details.

Copy link
Contributor

@xavdid xavdid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what an awesome PR!! A couple of little organizational things. Feel free to fix and/or ignore if you disagree.

package.json Outdated
@@ -28,6 +28,7 @@
"lint": "node_modules/.bin/eslint zapier.js src",
"lint-snippets": "node_modules/.bin/eslint snippets --rule 'no-unused-vars: 0' --ignore-pattern snippets/next.js",
"test": "npm run build && NODE_ENV=test node_modules/mocha/bin/mocha -t 30000 --recursive lib/tests && npm run lint && npm run lint-snippets",
"smoke-test": "npm run build && NODE_ENV=test node_modules/mocha/bin/mocha -t 30000 --recursive lib/smoke-tests",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node_modules/mocha/bin/mocha can just be mocha (same with above line)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, might make a pretest script that runs build and run it manually from here (it'll get picked up before test automatically)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice suggestion! Fixed in 00f2354.

};

before(() => {
if (process.env.DEPLOY_KEY) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool! is that anywhere in 1P or somewhere others will be able to access it?

}
}
context.package.version = context.package.filename.match(
/\d+\.\d+\.\d+/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be worth moving this regex into a constant so it can be enforced the same way across the package (since I bet we use the same pattern elsewhere)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made it a constant in 00f2354. I couldn't find anywhere else in the cli repo that uses this regex. So I think we can keep it in this file (smoke-tests.js) for now.

});
const baselineSize = res.headers.get('content-length');
const newSize = fs.statSync(context.package.path).size;
newSize.should.be.within(baselineSize * 0.7, baselineSize * 1.3);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool 😍

@eliangcs eliangcs merged commit f0c0284 into master Sep 25, 2018
@eliangcs eliangcs deleted the smoke-test branch September 25, 2018 08:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants