Skip to content

Commit 07838cd

Browse files
authored
Skip JSON quickstart test if env var not set (#4)
1 parent 311404b commit 07838cd

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

google-analytics-data/test/quickstart_json_credentials.test.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,16 @@ const GA4_PROPERTY_ID = process.env.GA_TEST_PROPERTY_ID || '222596558';
2828
const GOOGLE_APPLICATION_CREDENTIALS =
2929
process.env.GOOGLE_APPLICATION_CREDENTIALS;
3030

31-
describe('Quickstart with json credentials', () => {
32-
it('should run quickstart', async () => {
33-
// eslint-disable-next-line no-unused-vars
34-
const stdout = execSync(
35-
`node ./quickstart_json_credentials.js ${GA4_PROPERTY_ID} ${GOOGLE_APPLICATION_CREDENTIALS}`
36-
);
37-
assert.match(stdout, /Report result/);
31+
describe('Quickstart with json credentials', function() {
32+
it('should run quickstart if ADC env var set', function() {
33+
if (process.env.GOOGLE_APPLICATION_CREDENTIALS) {
34+
// eslint-disable-next-line no-unused-vars
35+
const stdout = execSync(
36+
`node ./quickstart_json_credentials.js ${GA4_PROPERTY_ID} ${GOOGLE_APPLICATION_CREDENTIALS}`
37+
);
38+
assert.match(stdout, /Report result/);
39+
} else {
40+
this.skip();
41+
}
3842
});
3943
});

0 commit comments

Comments
 (0)