[Git] Automatically running tests before commits with ghooks
Git with running before tests
2023-09-14 09:00:54 时间
Wouldn't it be nice if everyone ran the tests before committing code? With ghooks, you can automatically add a githook when dependencies are installed which will allow you to define common scripts to be run at various points during git actions (like committing). In this lesson, we'll add a githook for running the tests before we commit code to make sure we don't commit anything that breaks the tests.
Install:
npm i -D ghooks cross-env
[Notic]: cross-env is a package which enable you write Linux/mac scripts in your package.json and the same script can also run on Windows machine.
Config:
// package.json "config": { "ghooks": { "pre-commit": "npm run test:single", "post-merge": "npm install" } }
So before commit , it runs tests first and after merged, run npm install.
相关文章
- 一文吃透 VS Code+Git 操作(vs code中git的相关配置与使用)
- Git 常用及特殊命令笔记
- Git知识总览(一) 从 git clone 和 git status 谈起「建议收藏」
- 详细介绍git clone –depth=1的用法
- Git - Git基本概念与核心命令掌握
- Git分支管理使用规范
- 【说站】python中Git分支操作
- git强制删除本地分支_Git分支
- 架设私有的Git服务器[通俗易懂]
- 使用git depth为CI提速
- Git 本地项目连接远程仓库且推送到远程仓库
- Git的分支操作
- git安装配置
- git-版本更改
- 【Git】Git 基础命令 ( 查看提交记录 git log | 版本回滚 git reset | 撤销回滚 git reflog )
- 如何优雅的玩转 Git
- Git 2.40 发布,包括 git jump 工具的更新、cat-file 工具的增强以及提高 Windows 上响应速度
- Git查看文件制定行区间的提交记录详解程序员
- Linux快速配置Git环境(linux配置git)
- 实现Linux环境下的Git版本控制(linuxgit目录)
- 版本Linux 查看 Git 版本信息的方法(linux查看git)
- Linux环境下编译Git程序指南(linux编译git)
- 极速学习:Linux下使用Git的基础知识(linux如何使用git)
- 安装Git,轻松掌握Linux之美(linux的git安装)
- 分析学习Oracle深入理解使用With 分析(oracle使用with)
- 开创自动化Redis集群Git部署(redis集群git)
- nginx禁止访问.git文件的设置教程