小编Gya*_*eep的帖子

Windows上的Git 2.13条件配置

Git版本: 2.13.0.windows.1

操作系统: Windows 7

CLI: Git bash

的.gitconfig

[user]
    name = Gyandeep Singh
    email = private@email.com
[push]
    default = current
[core]
    autocrlf = input
[includeIf "gitdir: ~/Documents/webstorm/corporate/"]
    path = .gitconfig-work
Run Code Online (Sandbox Code Playgroud)

的.gitconfig工作

[user]
    name = Gyandeep Singh
    email = corporate@email.com
Run Code Online (Sandbox Code Playgroud)
  • 上面的两个配置文件都位于同一目录(home)中.

发生了什么:在公司文件夹内的文件夹(示例测试)上打开CLI,然后运行git config user.email输出private@email.com.

预期:结果应该是corporate@email.com.

我做错了什么或者我的期望不正确吗?我确实遵循了git文档.

你必须git config --show-origin --get user.email在git初始化目录上运行.如果它没有初始化git那么includeIf gitdir功能将不起作用.

它奇怪但真实.我希望它仍然奏效.

windows git git-bash

16
推荐指数
4
解决办法
3204
查看次数

如何在WebStorm中保存TSLint?

我怎样才能解决我的.ts文件,每次我保存在一个文件WebStorm

我知道我可以tslint --fix在保存后跑步.我也知道我可以⌥⏎+ 在文件中的当前错误,并将解决该错误.但我已经习惯了不同的样式指南,它可以节省我很多时间来自动修复这些样式lint错误:

tslint错误

我在WebStorm中找不到相关设置:

WebStorm设置

我也完全愿意使用不同的cli工具来实现保存时的自动创作.

webstorm typescript tslint

5
推荐指数
1
解决办法
3485
查看次数

仅对一个参数存根函数

所以基本上我有一个函数,仅当参数等于某个值时我才想对其行为进行存根。例子

var sinon = require('sinon');

var foo = {
    bar: function(arg1){
        return true;
    }
};

var barStub = sinon.stub(foo, "bar");
barStub.withArgs("test").returns("Hi");

// Expectations
console.log(foo.bar("test")); //works great as it logs "Hi"

// my expectation is to call the original function in all cases except 
// when the arg is "test"
console.log(foo.bar("woo")); //doesnt work as it logs undefined
Run Code Online (Sandbox Code Playgroud)

我正在使用这个包https://www.npmjs.com/package/sinon

javascript mocking node.js sinon

4
推荐指数
1
解决办法
2010
查看次数

标签 统计

git ×1

git-bash ×1

javascript ×1

mocking ×1

node.js ×1

sinon ×1

tslint ×1

typescript ×1

webstorm ×1

windows ×1