如何在我的量角器测试规范中包含lodash? [英] How do I include lodash in my protractor test specs?

查看:94
本文介绍了如何在我的量角器测试规范中包含lodash?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的量角器规范中使用lodash函数,我正在使用_.forEach()来填充带有值的表单。

I want to use lodash functions in my protractor spec, I'm using _.forEach() to fill a form with values.

我如何获得lodash进入我的量角器脚本以便我可以使用它?

How do I get lodash into my protractor script so that I can use it?

我不是在我的应用程序中询问如何使用它,而是在实际运行的量角器脚本中

I'm not asking how to use it in my app, but in the actual running protractor scripts

推荐答案

您可以使用本机Array.forEach()。如果你需要lodash,请执行以下操作:

You can use the native Array.forEach(). If you need lodash do this:

获取节点依赖性。

npm install lodash --save-dev

然后在测试中使用它。

var _ = require('lodash');

describe('foo', function() {
  it('should do stuff', function() {
    _.each();
  });
})

这篇关于如何在我的量角器测试规范中包含lodash?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆