Skip to content

Commit 2cb4f04

Browse files
authored
Merge branch 'main' into ariwete-run-idp-sql
2 parents 3867b44 + 0ef037a commit 2cb4f04

File tree

20 files changed

+202
-67
lines changed

20 files changed

+202
-67
lines changed

.github/config/nodejs-dev.jsonc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@
8585
"appengine/hello-world/flexible_nodejs16_and_earlier",
8686
"appengine/hello-world/standard",
8787
"appengine/memcached",
88+
"appengine/analytics",
89+
"appengine/metadata/flexible",
8890
"appengine/metadata/flexible_nodejs16_and_earlier",
8991
"appengine/metadata/standard",
9092
"appengine/pubsub",
@@ -197,6 +199,7 @@
197199
"run/jobs",
198200
"run/logging-manual",
199201
"run/idp-sql",
202+
"run/markdown-preview/editor",
200203
"run/markdown-preview/renderer",
201204
"run/pubsub",
202205
"run/system-package",

.github/config/nodejs-prod.jsonc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@
7676

7777
// TODO: fix these
7878
"ai-platform/snippets", // PERMISSION_DENIED: Permission denied: Consumer 'projects/undefined' has been suspended.
79-
"appengine/analytics", // [ERR_REQUIRE_ESM]: require() of ES Module
80-
"appengine/metadata/flexible", // [ERR_REQUIRE_ESM]: require() of ES Module
8179
"automl", // (untested) FAILED_PRECONDITION: Google Cloud AutoML Natural Language was retired on March 15, 2024. Please migrate to Vertex AI instead
8280
"cloud-sql/mysql/mysql", // (untested) Error: expected 200 "OK", got 500 "Internal Server Error"
8381
"cloud-sql/mysql/mysql2", // (untested) Error: Cannot find module './connect-connector-with-iam-authn.js'
@@ -98,7 +96,6 @@
9896
"healthcare/fhir", // Error: Cannot find module 'whatwg-url'
9997
"iam/deny", // PERMISSION_DENIED: Permission iam.googleapis.com/denypolicies.create denied on resource cloudresourcemanager.googleapis.com/projects/long-door-651
10098
"recaptcha_enterprise/snippets", // Cannot use import statement outside a module
101-
"run/markdown-preview/editor", // (untested) Error: could not create an identity token: Cannot fetch ID token in this environment, use GCE or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to a service account credentials JSON file
10299
"scheduler", // SyntaxError: Cannot use import statement outside a module
103100
"storagetransfer", // CredentialsError: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1
104101
"video-intelligence", // PERMISSION_DENIED: The caller does not have permission

appengine/analytics/app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
'use strict';
1616

1717
// [START gae_flex_analytics_track_event]
18-
const express = require('express');
19-
const fetch = require('node-fetch');
18+
import express from 'express';
19+
import fetch from 'node-fetch';
2020

2121
const app = express();
2222
app.enable('trust proxy');
@@ -77,4 +77,4 @@ app.listen(PORT, () => {
7777

7878
// [END gae_flex_analytics_track_event]
7979

80-
module.exports = app;
80+
export default app;

appengine/analytics/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"type": "git",
1010
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
1111
},
12+
"type": "module",
1213
"engines": {
1314
"node": "20.x"
1415
},

appengine/analytics/test/app.test.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
const supertest = require('supertest');
2-
const path = require('path');
3-
const app = require(path.join(__dirname, '../', 'app.js'));
1+
// Copyright 2020 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
import supertest from 'supertest';
16+
import app from '../app.js';
417

518
describe('gae_flex_analytics_track_event', () => {
619
it('should be listening', async () => {

appengine/metadata/flexible/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"type": "git",
1010
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
1111
},
12+
"type": "module",
1213
"engines": {
1314
"node": ">= 18.x.x"
1415
},

appengine/metadata/flexible/server.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
'use strict';
1616

1717
// [START gae_flex_metadata]
18-
const express = require('express');
19-
const fetch = require('node-fetch');
18+
import express from 'express';
19+
import fetch from 'node-fetch';
2020

2121
const app = express();
2222
app.enable('trust proxy');
@@ -58,4 +58,4 @@ app.listen(PORT, () => {
5858
console.log('Press Ctrl+C to quit.');
5959
});
6060
// [END gae_flex_metadata]
61-
module.exports = app;
61+
export default app;

appengine/metadata/flexible/test/server.test.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
const path = require('path');
2-
const app = require(path.join(__dirname, '../', 'server.js'));
3-
const supertest = require('supertest');
1+
// Copyright 2020 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
import supertest from 'supertest';
16+
import app from '../server.js';
417

518
describe('gae_flex_metadata', () => {
619
it('should be listening', async () => {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"env": {
3+
"SERVICE_NAME": "markdown-renderer-$RUN_ID",
4+
"SAMPLE_VERSION": "$RUN_ID"
5+
}
6+
}

run/markdown-preview/editor/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"main": "main.js",
1616
"scripts": {
1717
"start": "node index.js",
18-
"test": "c8 mocha -p -j 2 test/app.test.js --timeout=10000 --exit",
18+
"test": "npm -- run all-test",
19+
"all-test": "npm run unit-test && npm run system-test",
20+
"unit-test": "c8 mocha -p -j 2 test/app.test.js --timeout=10000 --exit",
1921
"system-test": "c8 mocha -p -j 2 test/system.test.js --timeout=480000 --exit"
2022
},
2123
"dependencies": {

0 commit comments

Comments
 (0)