Skip to content

Commit

Permalink
Avoiding AWS credentials for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Benni-Math committed Sep 3, 2024
1 parent 6fba8fd commit b5c168c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/setup.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
const fs = require('fs');
const path = require('path');
const process = require('process');

const tempy = require('tempy');

module.exports = async () => {
const confPath = tempy.directory();
const tempDir = tempy.directory();

// Set conf file path to temporary directory
const confPath = path.join(tempDir, 'conf/');
process.env.CACCL_DEPLOY_CONF_DIR = confPath;

// Set NODE_ENV to test to avoid certain checks
process.env.NODE_ENV = 'test';

// We need to write empty config and credential files
// to satisfy the aws-skd-mock
const awsConfPath = path.join(tempDir, 'config');
process.env.AWS_CONFIG_FILE = awsConfPath;
fs.writeFileSync(awsConfPath, '');

const awsCredPath = path.join(tempDir, 'credentials');
process.env.AWS_SHARED_CREDENTIALS_FILE = awsCredPath;
fs.writeFileSync(awsCredPath, '');
};

0 comments on commit b5c168c

Please sign in to comment.