possible to replace subset of exports from module?
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript
- 领域
- testing
调研方向
Start with td.test.js and the replaceEsm entry point to determine whether partial export replacement is supported. Use sample.js as the fixture and make the test demonstrate preserving a while replacing b; done means both assertions pass without moving the functions.
由索引模型根据 Issue 内容生成。
描述
sample.js
export {a, b}
function a() {
return b()
}
function b() {
return 'b'
}
want to replace
b()but preservea()...
td.test.js
import test from 'ava'
import * as td from 'testdouble'
// import {a} from './sample.js'
let mock
test.beforeEach(async () => {
// unclear how to use second parameter here, is this a potential solution?
// or is the ask not supported and would need to place `a` and `b` in separate files?
//
mock = await td.replaceEsm('./sample.js')
})
test.afterEach(async () => {
td.reset()
})
test('a', (t) => {
td.when(mock.b()).thenResolve('bee')
t.is(mock.a(), 'bee')
})
test('b', (t) => {
td.when(mock.b()).thenReturn('be')
t.is(mock.b(), 'be')
})
- 主要语言
- JavaScript
- 星标
- 1.4k
- 派生
- 140
- 平均合并
- 5 小时 55 分钟
- 30 天内合并 PR
- 4
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
testdouble/testdouble.js 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 45/100
testdouble/testdouble.js#538 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 45/100
testdouble/testdouble.js#537 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
testdouble/testdouble.js#534 ·
-
难度 1/5 1 小时以内 新手友好度 45/100
testdouble/testdouble.js#533 ·
-
难度 4/5 3-5 天 新手友好度 32/100
testdouble/testdouble.js#532 · 1 条评论 ·
查看 testdouble/testdouble.js 的全部 Issue
相似的 Issue
-
documentation good first issue help wanted
难度 1/5 1-3 小时 新手友好度 92/100
维护者通常 1 天内回复
-
automated issue report
难度 1/5 1 小时以内 新手友好度 85/100
lirantal/discoprint#29 ·
维护者通常 1 天内回复
-
feature-request
难度 2/5 1-3 小时 新手友好度 68/100
louislam/uptime-kuma#7914 · 1 条评论 ·
维护者通常 1 天内回复
-
Code Cleanup dependencies
难度 1/5 1 小时以内 新手友好度 68/100
ProjectSidewalk/SidewalkWebpage#5609 ·
维护者通常 1 天内回复
-
help wanted javascript
难度 2/5 1-3 小时 新手友好度 68/100
OWASP/cornucopia#3538 ·
维护者通常 1 天内回复