-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use supertest instead of repo-tools test app #1416
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,15 +15,17 @@ | |
"scripts": { | ||
"deploy": "gcloud app deploy", | ||
"start": "node app.js", | ||
"system-test": "repo-tools test app", | ||
"system-test": "mocha --exit test/*.test.js", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests don't finish without There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default for I think it's reasonable to go back to the old default ... alternatively you'd need to capture the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So by using |
||
"test": "npm run system-test", | ||
"e2e-test": "repo-tools test deploy" | ||
}, | ||
"dependencies": { | ||
"express": "^4.16.3" | ||
}, | ||
"devDependencies": { | ||
"@google-cloud/nodejs-repo-tools": "^3.3.0" | ||
"@google-cloud/nodejs-repo-tools": "^3.3.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can delete this dependency now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No :) It's used in the e2e-test. But turns out, we're not calling 2e2-test from CI, instead we have special test files that run a deployment. But I'll prefer deleting it in a separate PR. There's a lot of magic happening in |
||
"mocha": "^6.1.4", | ||
"supertest": "^4.0.2" | ||
}, | ||
"cloud-repo-tools": { | ||
"test": { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const app = require('../app'); | ||
|
||
const request = require('supertest'); | ||
|
||
describe('GET /', () => { | ||
it('should get 200', done => { | ||
request(app) | ||
.get('/') | ||
.expect(200, done); | ||
}), | ||
it('should get Hello World', done => { | ||
request(app) | ||
.get('/') | ||
.expect('Hello, world!', done); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fun idea which you can take or leave, if you add
c8
as a dependency, it turns on Node's V8 coverage collection, so the user gets:also understand if you think this is too much information for the user all at once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to keep dependencies as light as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But lol, that coverage looks good!