Skip to content
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

chore: refactor repo tools usage #1639

Merged
merged 24 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions appengine/analytics/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,6 @@ app.listen(PORT, () => {
console.log(`App listening on port ${PORT}`);
console.log('Press Ctrl+C to quit.');
});

module.exports = app;
// [END gae_flex_analytics_track_event]
5 changes: 3 additions & 2 deletions appengine/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@
},
"scripts": {
"start": "node app.js",
"system-test": "repo-tools test app",
"system-test": "mocha --exit test/*.test.js",
"test": "npm run system-test"
},
"dependencies": {
"express": "^4.16.4",
"got": "^10.0.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0"
"mocha": "^7.0.0",
"supertest": "^4.0.2"
},
"cloud-repo-tools": {
"test": {
Expand Down
7 changes: 7 additions & 0 deletions appengine/analytics/test/app.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const supertest = require('supertest');
const path = require('path');
const app = require(path.join(__dirname, '../', 'app.js'));

it('should be listening', async () => {
await supertest(app).get('/').expect(200);
});
6 changes: 4 additions & 2 deletions appengine/building-an-app/build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"start": "node server.js",
"deploy": "gcloud app deploy",
"test": "repo-tools test app -- server.js"
"test": "mocha --exit test/*.test.js"
},
"repository": {
"type": "git",
Expand All @@ -22,7 +22,9 @@
"express": "^4.16.3"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0"
"mocha": "^7.0.0",
"supertest": "^4.0.2",
"proxyquire": "^2.1.3"
},
"cloud-repo-tools": {
"requiresKeyFile": false,
Expand Down
7 changes: 7 additions & 0 deletions appengine/building-an-app/build/test/server.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const supertest = require('supertest');
const path = require('path');
const app = require(path.join(__dirname, '../', 'server.js'));

it('should be listening', async () => {
await supertest(app).get('/').expect(200);
});
1 change: 0 additions & 1 deletion appengine/building-an-app/update/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"express": "^4.16.3"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0",
"mocha": "^7.0.0",
"sinon": "^9.0.0",
"supertest": "^4.0.2",
Expand Down
6 changes: 3 additions & 3 deletions appengine/cloudsql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"node": ">=8.0.0"
},
"scripts": {
"unit-test": "mocha test/*.test.js --timeout=60000",
"unit-test": "mocha --exit test/createTables.test.js; mocha --exit server.test.js",
"start-proxy": "! pgrep cloud_sql_proxy > /dev/null && cloud_sql_proxy -instances=$INSTANCE_CONNECTION_NAME=tcp:$SQL_PORT &",
"system-test": "repo-tools test app -- server.js",
"system-test": "mocha --exit test/serverListening.test.js",
"system-test-proxy": "npm run start-proxy; npm run system-test",
"all-test": "npm run unit-test && npm run system-test",
"test": "repo-tools test run --cmd npm -- run all-test"
"test": "npm -- run all-test"
},
"dependencies": {
"express": "^4.16.4",
Expand Down
11 changes: 11 additions & 0 deletions appengine/cloudsql/test/serverListening.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const app = require('../server');

const request = require('supertest');

describe('start app', () => {
describe('GET /', () => {
it('should get 200', (done) => {
request(app).get('/').expect(200, done);
});
});
});
5 changes: 2 additions & 3 deletions appengine/cloudsql_postgresql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"scripts": {
"unit-test": "mocha test/*.test.js --timeout=30000",
"start-proxy": "! pgrep cloud_sql_proxy > /dev/null && cloud_sql_proxy -instances=$INSTANCE_CONNECTION_NAME=tcp:$SQL_PORT &",
"system-test": "repo-tools test app -- server.js",
"system-test": "mocha --exit test/*.test.js",
"system-test-proxy": "npm run start-proxy; npm run system-test",
"all-test": "npm run unit-test && npm run system-test",
"test": "repo-tools test run --cmd npm -- run all-test"
"test": "npm -- run all-test"
},
"dependencies": {
"express": "^4.16.4",
Expand All @@ -27,7 +27,6 @@
"prompt": "^1.0.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0",
"mocha": "^7.0.0",
"proxyquire": "^2.1.0",
"sinon": "^9.0.0",
Expand Down
11 changes: 11 additions & 0 deletions appengine/cloudsql_postgresql/test/serverListening.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const app = require('../server');

const request = require('supertest');

describe('start app', () => {
describe('GET /', () => {
it('should get 200', (done) => {
request(app).get('/').expect(200, done);
});
});
});
5 changes: 3 additions & 2 deletions appengine/datastore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@
},
"scripts": {
"start": "node app.js",
"system-test": "repo-tools test app",
"system-test": "mocha --exit test/*.test.js",
"test": "npm run system-test"
},
"dependencies": {
"@google-cloud/datastore": "^5.0.0",
"express": "^4.16.4"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0"
"mocha": "^7.0.0",
"supertest": "^4.0.2"
},
"cloud-repo-tools": {
"test": {
Expand Down
7 changes: 7 additions & 0 deletions appengine/datastore/test/app.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const supertest = require('supertest');
const path = require('path');
const app = require(path.join(__dirname, '../', 'app.js'));

it('should be listening', async () => {
await supertest(app).get('/').expect(200);
});
8 changes: 3 additions & 5 deletions appengine/endpoints/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,16 @@
"scripts": {
"deploy": "gcloud app deploy",
"start": "node app.js",
"unit-test": "mocha test/ --timeout=60000 --exit",
"system-test": "repo-tools test app",
"unit-test": "mocha test/app.test.js --timeout=60000 --exit",
"system-test": "mocha --exit test/appListening.test.js",
"all-test": "npm run unit-test && npm run system-test",
"test": "repo-tools test run --cmd npm -- run all-test",
"e2e-test": "repo-tools test deploy"
"test": "npm -- run all-test"
},
"dependencies": {
"body-parser": "^1.18.3",
"express": "^4.16.4"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0",
"mocha": "^7.0.0",
"proxyquire": "^2.1.0",
"sinon": "^9.0.0",
Expand Down
11 changes: 11 additions & 0 deletions appengine/endpoints/test/appListening.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const app = require('../app.js');

const request = require('supertest');

describe('start app', () => {
describe('GET /', () => {
it('should get 200', (done) => {
request(app).get('/').expect(200, done);
});
});
});
2 changes: 2 additions & 0 deletions appengine/mailjet/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,5 @@ const server = app.listen(process.env.PORT || 8080, () => {
console.log('App listening on port %s', server.address().port);
console.log('Press Ctrl+C to quit.');
});

module.exports = app;
5 changes: 3 additions & 2 deletions appengine/mailjet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"scripts": {
"start": "node app.js",
"system-test": "repo-tools test app",
"system-test": "mocha --exit test/*.test.js",
"test": "npm run system-test"
},
"dependencies": {
Expand All @@ -24,7 +24,8 @@
"node-mailjet": "^3.3.1"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0"
"mocha": "^7.0.0",
"supertest": "^4.0.2"
},
"cloud-repo-tools": {
"test": {
Expand Down
11 changes: 11 additions & 0 deletions appengine/mailjet/test/app.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const app = require('../app');

const request = require('supertest');

describe('start app', () => {
describe('GET /', () => {
it('should get 200', (done) => {
request(app).get('/').expect(200, done);
});
});
});
2 changes: 2 additions & 0 deletions appengine/memcached/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ app.listen(PORT, () => {
console.log(`App listening on port ${PORT}`);
console.log('Press Ctrl+C to quit.');
});

module.exports = app;
5 changes: 3 additions & 2 deletions appengine/memcached/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
},
"scripts": {
"start": "node app.js",
"test": "repo-tools test app"
"test": "mocha --exit test/*.test.js"
},
"dependencies": {
"express": "^4.16.4",
"memjs": "^1.2.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0"
"mocha": "^7.0.0",
"supertest": "^4.0.2"
}
}
11 changes: 11 additions & 0 deletions appengine/memcached/test/app.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const app = require('../app');

const request = require('supertest');

describe('start app', () => {
describe('GET /', () => {
it('should get 200', (done) => {
request(app).get('/').expect(200, done);
});
});
});
5 changes: 3 additions & 2 deletions appengine/metadata/flexible/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
"node": ">=8.0.0"
},
"scripts": {
"system-test": "repo-tools test app -- server.js",
"system-test": "mocha --exit test/*.test.js",
"test": "npm run system-test"
},
"dependencies": {
"express": "^4.16.4",
"got": "^10.0.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0"
"mocha": "^7.0.0",
"supertest": "^4.0.2"
},
"cloud-repo-tools": {
"test": {
Expand Down
7 changes: 7 additions & 0 deletions appengine/metadata/flexible/test/server.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const supertest = require('supertest');
const path = require('path');
const app = require(path.join(__dirname, '../', 'server.js'));

it('should be listening', async () => {
await supertest(app).get('/').expect(200);
});
5 changes: 3 additions & 2 deletions appengine/metadata/standard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
"node": ">=8.0.0"
},
"scripts": {
"system-test": "repo-tools test app -- ./server.js",
"system-test": "mocha --exit test/*.test.js",
"test": "npm run system-test"
},
"dependencies": {
"express": "^4.16.4",
"got": "^10.0.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0"
"mocha": "^7.0.0",
"supertest": "^4.0.2"
},
"cloud-repo-tools": {
"test": {
Expand Down
7 changes: 7 additions & 0 deletions appengine/metadata/standard/test/server.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const supertest = require('supertest');
const path = require('path');
const app = require(path.join(__dirname, '../', 'server.js'));

it('should be listening', async () => {
await supertest(app).get('/').expect(200);
});
2 changes: 1 addition & 1 deletion appengine/pubsub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"scripts": {
"start": "node app.js",
"test": "repo-tools test app && mocha */*.test.js --timeout=30000 --exit"
"test": "repo-tools test app && mocha test/app.test.js --timeout=30000 --exit"
},
"dependencies": {
"@google-cloud/pubsub": "^1.0.0",
Expand Down
11 changes: 11 additions & 0 deletions appengine/pubsub/test/appListening.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const app = require('../app');

const request = require('supertest');

describe('start app', () => {
describe('GET /', () => {
it('should get 200', (done) => {
request(app).get('/').expect(200, done);
});
});
});
5 changes: 3 additions & 2 deletions appengine/redis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"scripts": {
"start": "node server.js",
"test": "repo-tools test app -- server.js"
"test": "mocha test/*.test.js --timeout=30000 --exit"
},
"cloud-repo-tools": {
"test": {
Expand All @@ -32,6 +32,7 @@
"redis": "^3.0.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0"
"mocha": "^7.0.0",
"supertest": "^4.0.2"
}
}
11 changes: 11 additions & 0 deletions appengine/redis/test/server.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const supertest = require('supertest');
const path = require('path');
const app = require(path.join(__dirname, '../', 'server.js'));

after(() => {
process.exitCode(0);
});

it('should be listening', async () => {
await supertest(app).get('/').expect(200);
});
3 changes: 1 addition & 2 deletions appengine/sendgrid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"scripts": {
"start": "node app.js",
"test": "repo-tools test app && mocha test/*.test.js"
"test": "mocha test/*.test.js"
},
"dependencies": {
"body-parser": "^1.19.0",
Expand All @@ -19,7 +19,6 @@
"@sendgrid/client": "^6.3.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0",
"mocha": "^7.0.0",
"supertest": "^4.0.2",
"proxyquire": "^2.1.3"
Expand Down
7 changes: 7 additions & 0 deletions appengine/sendgrid/test/appListening.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const supertest = require('supertest');
const path = require('path');
const app = require(path.join(__dirname, '../', 'app.js'));

it('should be listening', async () => {
await supertest(app).get('/').expect(200);
});
Loading