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 all 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
2 changes: 1 addition & 1 deletion appengine/cloudsql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"system-test": "repo-tools test app -- server.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
2 changes: 1 addition & 1 deletion appengine/cloudsql_postgresql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"system-test": "repo-tools test app -- server.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
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);
});
3 changes: 1 addition & 2 deletions appengine/endpoints/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"unit-test": "mocha test/ --timeout=60000 --exit",
"system-test": "repo-tools test app",
"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": "repo-tools test run --cmd npm -- run all-test"
},
"dependencies": {
"body-parser": "^1.18.3",
Expand Down
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);
});
});
});
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
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);
});
2 changes: 2 additions & 0 deletions appengine/static-files/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ app.listen(PORT, () => {
console.log(`App listening on port ${PORT}`);
console.log('Press Ctrl+C to quit.');
});

module.exports = app;
// [END gae_flex_node_static_files]
5 changes: 3 additions & 2 deletions appengine/static-files/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 --url localhost:8080/static/main.css"
"test": "mocha --exit test/*.test.js --url localhost:8080/static/main.css"
},
"cloud-repo-tools": {
"test": {
Expand All @@ -25,6 +25,7 @@
"pug": "^2.0.3"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0"
"mocha": "^7.0.0",
"supertest": "^4.0.2"
}
}
7 changes: 7 additions & 0 deletions appengine/static-files/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);
});
1 change: 0 additions & 1 deletion appengine/storage/flexible/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"pug": "^2.0.3"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0",
"mocha": "^7.0.0",
"supertest": "^4.0.2",
"proxyquire": "^2.1.3"
Expand Down
1 change: 0 additions & 1 deletion appengine/storage/standard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"pug": "^2.0.3"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0",
"mocha": "^7.0.0",
"supertest": "^4.0.2",
"proxyquire": "^2.1.3"
Expand Down
3 changes: 1 addition & 2 deletions appengine/typescript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import express = require('express');

const PORT = Number(process.env.PORT) || 8080;
import * as express from "express";

const app = express();

app.get("/", (req, res) => {
Expand Down
2 changes: 1 addition & 1 deletion appengine/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"scripts": {
"prepare": "npm run gcp-build",
"pretest": "npm run gcp-build",
"test": "repo-tools test app -- index.js",
"test": "repo-tools test app -- index.js",
"posttest": "npm run lint",
"lint": "tslint -p .",
"start": "node ./index.js",
Expand Down
6 changes: 3 additions & 3 deletions appengine/websockets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
"start": "node app.js",
"lint": "eslint .",
"fix": "eslint --fix .",
"test": "repo-tools test app & mocha */*.test.js --timeout=30000 --exit",
"test": "mocha --exit test/*.test.js",
"e2e-test": "samples test deploy"
},
"dependencies": {
"express": "^4.15.4",
"pug": "^2.0.3",
"socket.io": "^2.2.0"
"socket.io": "^2.2.0",
"supertest": "^4.0.2"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0",
"eslint": "^6.0.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-node": "^11.0.0",
Expand Down
7 changes: 7 additions & 0 deletions appengine/websockets/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);
});
3 changes: 1 addition & 2 deletions auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
"node": ">=8.0.0"
},
"scripts": {
"test": "repo-tools test run --cmd=npm -- run system-test",
"test": "npm -- run system-test",
"system-test": "mocha system-test/*.test.js --timeout=30000"
},
"dependencies": {
"@google-cloud/storage": "^4.0.0",
"yargs": "^15.0.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0",
"mocha": "^7.0.0"
}
}
Loading