1 Star 0 Fork 0

alapha23/Serverless-Devs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
jest.setup.ts 1.05 KB
一键复制 编辑 原始数据 按行查看 历史
/** @format */
import path from 'path';
import os from 'os';
import fs from 'fs-extra';
import logger from './src/utils/logger';
import yaml from 'js-yaml';
jestBeforeDetection();
function jestBeforeDetection() {
if (!detectioIsExist('.s/access.yaml')) {
logger.error(`Failed to execute:\n
❌ Message: Please install S component
😈 If you have questions, please tell us: https://github.com/Serverless-Devs/Serverless-Devs/issues\n`);
process.exit(-1);
}
if (Object.keys(getAccessFile()).length === 0) {
logger.error(`Failed to execute:\n
❌ Message: Please configure your Secret
😈 If you have questions, please tell us: https://github.com/Serverless-Devs/Serverless-Devs/issues\n`);
process.exit(-1);
}
}
function detectioIsExist(road) {
return fs.existsSync(getPath(road));
}
function getAccessFile() {
const accessFile = getPath('.s/access.yaml');
const accessFileInfo = yaml.load(fs.readFileSync(accessFile, 'utf-8') || '{}');
return accessFileInfo;
}
function getPath(road) {
return path.join(os.homedir(), road);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/alapha23/Serverless-Devs.git
git@gitee.com:alapha23/Serverless-Devs.git
alapha23
Serverless-Devs
Serverless-Devs
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385