我使用 typescript 创建了一个生成器,该生成器使用了一个使用子生成器的子生成器(使用 composeWith
子句):
configuring(){
this.composeWith('mygen:sub',options)
}
我正在尝试使用 yeoman-test
(打字稿...)测试我的生成器:
await run(path.join(__dirname, '../generators/app'), {})
.inDir('./temp-templates')
.withPrompts({
serviceName: 'my service',
})
.withGenerators([path.join(__dirname, '../generators/sub/')]);
当我运行测试时它失败并显示错误: You don't seem to have a generator with the name “mygen:sub” installed.
当我使用 CLI 运行我的生成器时,它按预期工作。
当我尝试调试我的测试时,我注意到命名空间解析不正确,而不是将子生成器命名空间计算为 mygen:sub
,而是将其计算为 path:to:mygen:sub
附近有吗?
我正在使用:
自耕农发电机:4.13.0, 自耕农测试:4.0.2