From b5c168cb43c285dbb24e2cb060338c23a2314877 Mon Sep 17 00:00:00 2001 From: Benni-Math Date: Mon, 2 Sep 2024 22:18:02 -0400 Subject: [PATCH] Avoiding AWS credentials for tests --- test/setup.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/setup.js b/test/setup.js index 051459e..a367368 100644 --- a/test/setup.js +++ b/test/setup.js @@ -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, ''); };