很烦人的是,我每次尝试推送新分支时都会收到提示。例如,我这样做
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)
有没有办法跳过这个?
我的 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[]没用
假设我有这个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)
但它不起作用。