diff --git a/.kokoro/functions-helloworld.sh b/.kokoro/functions-helloworld.sh index a711e41e49..c361642fbd 100755 --- a/.kokoro/functions-helloworld.sh +++ b/.kokoro/functions-helloworld.sh @@ -16,7 +16,7 @@ export GCLOUD_PROJECT=nodejs-docs-samples-tests STAGE_BUCKET=$GCLOUD_PROJECT -GCP_REGION=us-central1 +export GCP_REGION=us-central1 export FUNCTIONS_TOPIC=integration-test-functions export FUNCTIONS_BUCKET=$FUNCTIONS_TOPIC export BASE_URL=https://${GCP_REGION}-${GCLOUD_PROJECT}.cloudfunctions.net @@ -26,6 +26,9 @@ cd github/nodejs-docs-samples/functions/helloworld # Install dependencies npm install +# Install global dependencies used in some integration tests. +npm install -g @google-cloud/functions-emulator@1.0.0-beta.4 + # Configure gcloud export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secrets-key.json gcloud auth activate-service-account --key-file "$GOOGLE_APPLICATION_CREDENTIALS" diff --git a/circle.yml b/circle.yml index 61df83066f..711e876a32 100644 --- a/circle.yml +++ b/circle.yml @@ -31,7 +31,7 @@ dependencies: override: - echo $KEYFILE > /home/ubuntu/nodejs-docs-samples/key.json - gcloud auth activate-service-account --key-file /home/ubuntu/nodejs-docs-samples/key.json || true - - yarn global add ava nyc codecov semistandard @google-cloud/nodejs-repo-tools@1.4.17 @google-cloud/functions-emulator@1.0.0-beta.4 + - yarn global add ava nyc codecov @google-cloud/nodejs-repo-tools@1.4.17 @google-cloud/functions-emulator@1.0.0-beta.4 - yarn install - yarn run lint - samples test install -l=functions/background diff --git a/functions/background/package.json b/functions/background/package.json index a2b69cb18f..dc792028dd 100644 --- a/functions/background/package.json +++ b/functions/background/package.json @@ -24,6 +24,7 @@ "@google-cloud/nodejs-repo-tools": "2.2.1", "ava": "0.25.0", "proxyquire": "2.0.0", + "semistandard": "^12.0.1", "sinon": "4.4.2" }, "cloud-repo-tools": { diff --git a/functions/datastore/package.json b/functions/datastore/package.json index e57fa1c0b3..957522866a 100644 --- a/functions/datastore/package.json +++ b/functions/datastore/package.json @@ -27,6 +27,7 @@ "@google-cloud/nodejs-repo-tools": "2.2.1", "ava": "0.25.0", "proxyquire": "2.0.0", + "semistandard": "^12.0.1", "sinon": "4.4.2" }, "cloud-repo-tools": { diff --git a/functions/gcs/package.json b/functions/gcs/package.json index 2e38ecdc3f..57d5d4c8b5 100644 --- a/functions/gcs/package.json +++ b/functions/gcs/package.json @@ -24,6 +24,7 @@ "@google-cloud/nodejs-repo-tools": "2.2.1", "ava": "0.25.0", "proxyquire": "2.0.0", + "semistandard": "^12.0.1", "sinon": "4.4.2" }, "cloud-repo-tools": { diff --git a/functions/helloworld/package.json b/functions/helloworld/package.json index f63bb9ebc1..e6a0bc0212 100644 --- a/functions/helloworld/package.json +++ b/functions/helloworld/package.json @@ -14,7 +14,7 @@ "scripts": { "lint": "repo-tools lint", "pretest": "npm run lint", - "e2e-test": "export FUNCTIONS_CMD='gcloud functions' && sh test/updateFunctions.sh && BASE_URL=\"https://$GCF_REGION-$GCLOUD_PROJECT.cloudfunctions.net/\" ava -T 20s --verbose test/*.test.js", + "e2e-test": "export FUNCTIONS_CMD='gcloud functions' && sh test/updateFunctions.sh && BASE_URL=\"https://$GCP_REGION-$GCLOUD_PROJECT.cloudfunctions.net/\" ava -T 20s --verbose test/*.test.js", "test": "export FUNCTIONS_CMD='functions-emulator' && sh test/updateFunctions.sh && export BASE_URL=\"http://localhost:8010/$GCLOUD_PROJECT/$GCF_REGION\" && ava -T 20s --verbose -c 1 test/index.test.js test/*unit*test.js test/*integration*test.js", "system-test": "export FUNCTIONS_CMD='functions-emulator' && sh test/updateFunctions.sh && export BASE_URL=\"http://localhost:8010/$GCLOUD_PROJECT/$GCF_REGION\" && ava -T 20s --verbose test/*.test.js" }, @@ -29,6 +29,7 @@ "@google-cloud/storage": "^1.5.0", "ava": "0.25.0", "proxyquire": "2.0.1", + "semistandard": "^12.0.1", "sinon": "4.4.8", "supertest": "^3.0.0", "uuid": "^3.1.0" diff --git a/functions/helloworld/test/sample.system.storage.test.js b/functions/helloworld/test/sample.system.storage.test.js index 7e6518bf9b..8b8d986774 100644 --- a/functions/helloworld/test/sample.system.storage.test.js +++ b/functions/helloworld/test/sample.system.storage.test.js @@ -25,7 +25,7 @@ const localFileName = `test.txt`; // Use unique GCS filename to avoid conflicts between concurrent test runs const gcsFileName = `test-${uuid.v4()}.txt`; -const bucketName = process.env.BUCKET_NAME; +const bucketName = process.env.FUNCTIONS_BUCKET; const bucket = storage.bucket(bucketName); const baseCmd = `gcloud functions`; diff --git a/functions/http/package.json b/functions/http/package.json index 5a82ee97e2..c247a385c6 100644 --- a/functions/http/package.json +++ b/functions/http/package.json @@ -20,6 +20,7 @@ "@google-cloud/nodejs-repo-tools": "2.2.1", "ava": "0.25.0", "proxyquire": "2.0.0", + "semistandard": "^12.0.1", "sinon": "4.4.2" }, "dependencies": { diff --git a/functions/imagemagick/package.json b/functions/imagemagick/package.json index cc13740847..3730317888 100644 --- a/functions/imagemagick/package.json +++ b/functions/imagemagick/package.json @@ -24,6 +24,7 @@ "@google-cloud/nodejs-repo-tools": "2.2.1", "ava": "0.25.0", "proxyquire": "2.0.0", + "semistandard": "^12.0.1", "sinon": "4.4.2" }, "cloud-repo-tools": { diff --git a/functions/log/package.json b/functions/log/package.json index 68690c8270..ffb4e84540 100644 --- a/functions/log/package.json +++ b/functions/log/package.json @@ -24,6 +24,7 @@ "@google-cloud/nodejs-repo-tools": "2.2.1", "ava": "0.25.0", "proxyquire": "2.0.0", + "semistandard": "^12.0.1", "sinon": "4.4.2" }, "cloud-repo-tools": { diff --git a/functions/pubsub/package.json b/functions/pubsub/package.json index 2d20824b0e..f4f8f3d315 100644 --- a/functions/pubsub/package.json +++ b/functions/pubsub/package.json @@ -24,6 +24,7 @@ "@google-cloud/nodejs-repo-tools": "2.2.1", "ava": "0.25.0", "proxyquire": "2.0.0", + "semistandard": "^12.0.1", "sinon": "4.4.2" }, "cloud-repo-tools": { diff --git a/functions/sendgrid/package.json b/functions/sendgrid/package.json index 1c91441313..d0ebeb0585 100644 --- a/functions/sendgrid/package.json +++ b/functions/sendgrid/package.json @@ -12,7 +12,7 @@ "node": ">=4.3.2" }, "scripts": { - "lint": "samples lint", + "lint": "repo-tools lint", "pretest": "npm run lint", "test": "ava -T 20s --verbose test/*.test.js" }, @@ -24,9 +24,10 @@ "uuid": "3.1.0" }, "devDependencies": { - "@google-cloud/nodejs-repo-tools": "2.1.0", + "@google-cloud/nodejs-repo-tools": "^2.3.0", "ava": "0.23.0", "proxyquire": "1.8.0", + "semistandard": "^12.0.1", "sinon": "4.0.2" }, "cloud-repo-tools": { diff --git a/functions/spanner/package.json b/functions/spanner/package.json index 51e2a85073..443255b106 100644 --- a/functions/spanner/package.json +++ b/functions/spanner/package.json @@ -23,6 +23,7 @@ "@google-cloud/nodejs-repo-tools": "2.2.1", "ava": "0.25.0", "proxyquire": "2.0.0", + "semistandard": "^12.0.1", "sinon": "4.4.2" }, "cloud-repo-tools": { diff --git a/functions/tips/package.json b/functions/tips/package.json index e29698ada7..b8c74643c1 100644 --- a/functions/tips/package.json +++ b/functions/tips/package.json @@ -22,6 +22,7 @@ "devDependencies": { "@google-cloud/nodejs-repo-tools": "2.2.5", "ava": "0.25.0", + "semistandard": "^12.0.1", "sinon": "^4.5.0" }, "cloud-repo-tools": { diff --git a/functions/uuid/package.json b/functions/uuid/package.json index e9d1a94b41..a6cc1babcf 100644 --- a/functions/uuid/package.json +++ b/functions/uuid/package.json @@ -22,6 +22,7 @@ "devDependencies": { "@google-cloud/nodejs-repo-tools": "2.2.1", "ava": "0.25.0", + "semistandard": "^12.0.1", "sinon": "4.4.2" }, "cloud-repo-tools": {