Skip to content

Conversation

taeold
Copy link
Contributor

@taeold taeold commented Feb 3, 2022

Add integration test for firebase-functions binary.

The integration setup is more robust than what we had before - it builds and installs the Functions SDK package at the branch commit and try to run the produced binary that ships with the Functions SDK.

We also modify the github CI/release script setting to run the integration test as part of its workflow.

@taeold taeold requested review from colerogers and inlined February 3, 2022 21:18
@taeold taeold marked this pull request as ready for review February 3, 2022 21:21
Copy link
Contributor

@colerogers colerogers left a comment

Choose a reason for hiding this comment

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

Nice stuff! yay tests!

reporter: spec
require:
- 'ts-node/register'
spec: spec/**/*.spec.ts
Copy link
Contributor

Choose a reason for hiding this comment

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

removing this just means that we now have test files outside the spec/ dir and they don't need spec in the title, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes - having the spec defined here made it impossible for me to not run them for integration tests. So we now pass in the path/glob of test we want to run in the npm script definition (in package.json) itself.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahhh the changed line - "test": "mocha --file ./mocha/setup.ts spec/**/*.spec.ts ",. Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

Hmm... there's no other way to achieve our goal? Changing mocha to need a --file means that running an individual file's tests with npx mocha got harder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm don't you still need to pass individual file via npx mocha, e.g. npx mocha spec/path/to/my/test.ts?

I'm not sure what devx I just broke here. I don't know if other ways exists, but happy to explore.

@taeold taeold merged commit f057ec2 into master Feb 3, 2022
@taeold taeold deleted the dl-integration-tests branch February 3, 2022 22:22
reporter: spec
require:
- 'ts-node/register'
spec: spec/**/*.spec.ts
Copy link
Member

Choose a reason for hiding this comment

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

Hmm... there's no other way to achieve our goal? Changing mocha to need a --file means that running an individual file's tests with npx mocha got harder.

) {
const sleep = () => {
return new Promise<void>((resolve) => {
setTimeout(() => resolve(), sleepMs);
Copy link
Member

Choose a reason for hiding this comment

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

nit: you can just pass a function rather than a lambda that calls the function:

setTimeout(resolve, sleepMs)

}
}).timeout(TIMEOUT_L);

if (semver.gt(process.versions.node, '13.2.0')) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: since 13 isnt' a supported major it would have been fine to say '14'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants