小编Ali*_*a Y的帖子

自动创建 --set-upstream origin 执行 git Push

很烦人的是,我每次尝试推送新分支时都会收到提示。例如,我这样做

git checkout -b myBranch
git add . && git commit -m 'first commit'
git push
Run Code Online (Sandbox Code Playgroud)

但我得到了这个

git push --set-upstream origin myBranch
Run Code Online (Sandbox Code Playgroud)

有没有办法跳过这个?

git github

10
推荐指数
2
解决办法
4688
查看次数

在打字稿中为响应提供一种获取响应类型?

我的 list.json 中有这个

[{"id": "1", "qty": 1}]
Run Code Online (Sandbox Code Playgroud)

我通过 fetch 调用它

async function fetchPlaces() {
  let response = await fetch(`./data/list.json`);
  response = await response.json();
}
Run Code Online (Sandbox Code Playgroud)

如何使响应与接口类型相同?

IList {
   id: string,
   qty: number
}
Run Code Online (Sandbox Code Playgroud)

我尝试了response = await response.json() as IList[]没用

javascript typescript reactjs

6
推荐指数
1
解决办法
9108
查看次数

修改cypress中的fixture数据并拦截

假设我有这个setting.json

{ data: { isDark: false } } 
Run Code Online (Sandbox Code Playgroud)

我像这样拦截它

cy.intercept("api/setting", {
    fixture: `setting.json`,
 })
Run Code Online (Sandbox Code Playgroud)

有效。

但我无法在 settings.json 中或当 isDark 为 true 时为一个新属性创建一个文件。那么如何在测试中更改setting.json 的属性值呢?

我试过

cy.intercept("api/setting", (req) => {
 const settingFixture = await cy.fixture('setting.json')

 req.continue((res) => {
  res.send(settingFixture.map((object)=>({...object, isDark: true}))
 })

 cy.visit('some where')
})
Run Code Online (Sandbox Code Playgroud)

但它不起作用。

javascript cypress

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

标签 统计

javascript ×2

cypress ×1

git ×1

github ×1

reactjs ×1

typescript ×1