Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
e20d811
Add environment variable checks and refactor live preview tests
harshithad0703 Apr 3, 2025
68d4090
Update environment variable checks and improve error handling in config
harshithad0703 Apr 8, 2025
7a6deb2
Bump version to 3.25.3 and update changelog to handle sanity tests wi…
harshithad0703 Apr 8, 2025
d4abca6
Update changelog date for version 3.25.3
harshithad0703 Apr 8, 2025
0de8500
Update integrity hashes in README
harshithad0703 Apr 8, 2025
e8a4541
Merge pull request #325 from contentstack/fix/dx-2231-handle-envs
harshithad0703 Apr 8, 2025
f8e8422
Fix: initialize live_preview config before setting properties in Live…
sunil-lakshman Apr 8, 2025
78d3401
Merge pull request #326 from contentstack/fix/sanity-testcases
AniketDev7 Apr 8, 2025
c7f13e6
test: added sync test cases with improved structure
harshithad0703 Apr 15, 2025
f117f1c
Fix: pagination token test
harshithad0703 Apr 15, 2025
59670d7
chore: update package-lock.json with dependency version bumps
harshithad0703 Apr 15, 2025
dec7cc4
Merge pull request #327 from contentstack/fix/dx-2392-sync-test-cases
harshithad0703 Apr 15, 2025
353bd24
chore: bump dependencies in package.json and package-lock.json
harshithad0703 Apr 15, 2025
121fb85
Merge branch 'staging' into fix/upgrade-dependencies
harshithad0703 Apr 15, 2025
43e4ba9
Merge pull request #329 from contentstack/fix/upgrade-dependencies
harshithad0703 Apr 15, 2025
085e856
Merge pull request #331 from contentstack/staging
harshithad0703 Apr 16, 2025
6e55a28
Update policy-scan.yml
aravindbuilt Apr 16, 2025
21661c9
Merge pull request #332 from contentstack/master
harshithad0703 Apr 16, 2025
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
Prev Previous commit
Next Next commit
Update environment variable checks and improve error handling in config
  • Loading branch information
harshithad0703 committed Apr 8, 2025
commit 68d409084153088c3b4cc1120b7d9e974aa327ff
14 changes: 5 additions & 9 deletions test/config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
'use strict';
require('dotenv').config()
require('dotenv').config();

const requiredVars = ['API_KEY', 'DELIVERY_TOKEN', 'ENVIRONMENT', 'HOST'];
const requiredVars = ['HOST', 'EMAIL', 'PASSWORD', 'ORGANIZATION', 'API_KEY'];
const missingVars = requiredVars.filter((key) => !process.env[key]);

if (missingVars.length > 0) {
const errorMessage = `\x1b[31mError: Missing environment variables - ${missingVars.join(', ')}`;

if (process.env.NODE_ENV === 'test' || process.env.JEST_WORKER_ID !== undefined) {
throw new Error(errorMessage);
} else {
console.error(errorMessage);
process.exit(1);
}
const error = new Error(errorMessage);
error.stack = error.message;
throw error;
}

module.exports = {
Expand Down