yeoman测试助手在哪里查找子生成器
Where does the yeoman test-helper look for sub-generators?
我正在制作一个自定义的自动生成器,并且我正在尝试为子生成器添加一些测试。
我不知道如何使用约曼的测试助手来完成这一点。我已经能够使用composeWith()
在主发电机旁边运行子发电机,但我无法让测试助手识别它。
此外,当我从测试文件中运行生成器时,与正常运行时(从命令行)相比,我得到了一些奇怪的差异。
在app/index.js:注意:这段代码在正常运行时失败,在我的测试中运行时失败。如果我将composeWith
函数更改为this.composeWith('my-generator:sub-generator')
,它可以从命令行运行成功,但在测试时仍然失败
initializing: function() {
this.composeWith('sub-generator');
},
在我的测试文件:
before(function (done) {
helpers.run(roundhouse)
.withGenerators([
[helpers.createDummyGenerator(), '../sub-generator']
])
.inDir(testDir)
.withPrompts(prompts.default)
.withOptions({"skipInstall": true})
.on('end', done);
});
从命令行(yo my-generator
)运行生成器时产生的错误:
You don't seem to have a generator with the name sub-generator installed.
You can see available generators with npm search yeoman-generator and then install them with npm install [name].
To see the 24 registered generators run yo with the `--help` option.
当从我的测试运行时:
Uncaught Error: You don't seem to have a generator with the name sub-generator installed.
You can see available generators with npm search yeoman-generator and then install them with npm install [name].
To see the 2 registered generators run yo with the `--help` option.
为什么我的测试文件看不到我安装的其他生成器?它告诉我只有2个而不是24个生成器
调用composeWith http://yeoman.io/authoring/composability.html时需要传递settings.local
传递路径本身将修复您可能遇到的大多数边缘情况。
相关文章:
- 在哪里使用名为“;冻结”;
- Ember.js-接口状态应该存储在哪里
- 在Redux中,我应该在哪里编写复杂的异步流
- 在哪里可以学习ECMAScript标准中尚未包含的JavaScript功能
- 在哪里可以找到RXUI Javascript'时间飞逝'实例
- Redux应用程序结构-在哪里放置服务/业务逻辑
- 在哪里可以找到'项目'在plothover函数中
- Javascript-在哪里放置常量,全局或本地
- Sequelize:这些方法应该驻留在哪里
- AJAX更新面板不;t工作.请帮我找出我错在哪里.
- 在哪里存储HTML模板以在Backbone.js中使用
- ForerunnerDB将其数据库保存在哪里
- 在哪里可以找到R-to-JavaScript编译器
- 很棒的共享按钮application.coffee文件在哪里
- WinJs中的视图状态更改事件在哪里
- metro.js-在哪里调用对集合的查找
- 零剪贴板的问题不确定在哪里查找
- 我的算法中查找数组最大元素的缺陷在哪里
- 有安卓内置浏览器开发者指南吗?在哪里查找JS引擎的差异
- yeoman测试助手在哪里查找子生成器