- 浏览: 1091843 次
文章分类
- 全部博客 (379)
- S2SH (16)
- stuts2 (0)
- java语言 (81)
- JSP (17)
- <html>元素 (11)
- javaweb (4)
- web容器 (3)
- ext (23)
- javaScript (48)
- ant (1)
- liferay (1)
- sql (9)
- css (42)
- 浏览器设置 (3)
- office_world (1)
- eclipse (4)
- 其它 (28)
- 操作系统 (5)
- android (6)
- Struts2 (11)
- RegEx (3)
- mysql (5)
- BigDATA (1)
- Node.js (1)
- Algorithm (10)
- Apache Spark (1)
- 数据库 (5)
- linux (2)
- git (1)
- Adobe (3)
- java语言,WebSocket (1)
- Maven (3)
- SHELL (1)
- XML (2)
- 数学 (2)
- Python (2)
- Java_mysql (1)
- ReactJS (6)
- 养生 (4)
- Docker (1)
- Protocols (3)
- java8 (2)
- 书籍 (1)
- Gradle (2)
- AngularJS (5)
- SpringMVC (2)
- SOAP (1)
- BootstrapCSS (1)
- HTTP协议 (1)
- OAuth2 (1)
最新评论
-
Lixh1986:
Java并发编程:自己动手写一把可重入锁https://blo ...
Java之多线程之Lock与Condition -
Lixh1986:
http://win.51apps.com.cn/https: ...
temp -
ztwsl:
不错,支持很好
HttpServletRequest和ServletRequest的区别 -
guodongkai:
谢谢您能将知识精华汇编总结,让初学者们从原理中学会和提高。
javaScript之function定义 -
kangwen23:
谢谢了,顶顶
struts2中的ValueStack学习
为什么使用 javascript 测试框架时,没有显式导入 describe,却可以直接使用:?
https://stackoverflow.com/questions/12209582/the-describe-keyword-in-javascript
问题:
So I am a newbie in javascript and i had been going through some one else's code and I found this..
我是 javascript 的新手,我遇到了别人写的代码如下:
What I don't understand is: What exactly does the describe keyword do?
我不明白的是:describe 关键字到底做了什么?
回答:
Describe is a function in the Jasmine testing framework. It simply describes the suite of test cases enumerated by the "it" functions.
Describe 是 Jasmine 测试框架的一个函数。它只是描述了一组用 it 函数枚举的测试用例。
Also used in the mochajs framework.
Describe 也被用在了 mochajs 测试框架中。
Describe is not part of Javascript, it is a function defined in the library you used (namely Jasmine)
Describe 不属于原生 Javascript 的一部分,它是定义在 Jasmine 框架的类库中。
http://jasmine.github.io/
--------------------------------------
"A test suite begins with a call to the global Jasmine function describe with two parameters: a string and a function. The string is a name or title for a spec suite - usually what is being tested. The function is a block of code that implements the suite."
来源:
http://jasmine.github.io/2.0/introduction.html
-------------------------------------------------------
https://www.bignerdranch.com/blog/why-do-javascript-test-frameworks-use-describe-and-beforeeach/
-------------------------------------------------------
原理:
Nodejs Global Functions
https://stackoverflow.com/questions/29544417/nodejs-global-functions
我有一个非常基础的函数,在 functions.js 文件中:
我在另一个文件中使用它:
然后在 mainFile 文件中运行:
结果出错了:
Is there a way for me to make a function that is global like that without havingin to use exports?
有没有一个方法,可以不使用 exports 关键字,而使这个函数可以全局访问?
回答:
Inside functions.js you'll have access to node's global variable, which is like the window variable in a browser. As Plato suggested in a comment, you can add this to the global by simply doing echo = function echo(input){ ... }. However, this will throw an error if you're using strict mode, which is intended to catch common mistakes (like accidentally creating global variables).
在 functions.js 文件中,你可以访问 nodejs 的全局变量 global,
这跟浏览器里面的 window 变量差不多。
像 Plato 建议的是,你可以将它添加到 gobal 中,通过以下方法:
但是,如果在 strict 模式下,这会报错。
-------------------------------------------------
One way to safely add echo as a global is to add it to the global global variable.
一个安全的方法是把 echo 添加到 global 变量中:
-
https://stackoverflow.com/questions/12209582/the-describe-keyword-in-javascript
问题:
So I am a newbie in javascript and i had been going through some one else's code and I found this..
我是 javascript 的新手,我遇到了别人写的代码如下:
describe('deviceready', function() { it('should report that it fired', function() { spyOn(app, 'report'); app.deviceready(); expect(app.report).toHaveBeenCalledWith('deviceready'); }); });
What I don't understand is: What exactly does the describe keyword do?
我不明白的是:describe 关键字到底做了什么?
回答:
Describe is a function in the Jasmine testing framework. It simply describes the suite of test cases enumerated by the "it" functions.
Describe 是 Jasmine 测试框架的一个函数。它只是描述了一组用 it 函数枚举的测试用例。
Also used in the mochajs framework.
Describe 也被用在了 mochajs 测试框架中。
Describe is not part of Javascript, it is a function defined in the library you used (namely Jasmine)
Describe 不属于原生 Javascript 的一部分,它是定义在 Jasmine 框架的类库中。
http://jasmine.github.io/
--------------------------------------
引用
"A test suite begins with a call to the global Jasmine function describe with two parameters: a string and a function. The string is a name or title for a spec suite - usually what is being tested. The function is a block of code that implements the suite."
来源:
http://jasmine.github.io/2.0/introduction.html
-------------------------------------------------------
https://www.bignerdranch.com/blog/why-do-javascript-test-frameworks-use-describe-and-beforeeach/
-------------------------------------------------------
原理:
Nodejs Global Functions
https://stackoverflow.com/questions/29544417/nodejs-global-functions
我有一个非常基础的函数,在 functions.js 文件中:
// functions.js function echo(input){ process.stdout.write(echo); }
我在另一个文件中使用它:
// another_file.js echo("hello!");
然后在 mainFile 文件中运行:
// main_file.js require("functions.js"); require("another_file.js");
结果出错了:
ReferenceError: echo is not defined
Is there a way for me to make a function that is global like that without havingin to use exports?
有没有一个方法,可以不使用 exports 关键字,而使这个函数可以全局访问?
回答:
Inside functions.js you'll have access to node's global variable, which is like the window variable in a browser. As Plato suggested in a comment, you can add this to the global by simply doing echo = function echo(input){ ... }. However, this will throw an error if you're using strict mode, which is intended to catch common mistakes (like accidentally creating global variables).
在 functions.js 文件中,你可以访问 nodejs 的全局变量 global,
这跟浏览器里面的 window 变量差不多。
像 Plato 建议的是,你可以将它添加到 gobal 中,通过以下方法:
echo = function echo(input){ process.stdout.write(echo); }; // 注意:echo 变量前,没有任何修饰符。
但是,如果在 strict 模式下,这会报错。
-------------------------------------------------
One way to safely add echo as a global is to add it to the global global variable.
一个安全的方法是把 echo 添加到 global 变量中:
"use strict"; global.echo = function echo(input) { process.stdout.write(input); }
https://stackoverflow.com/questions/29544417/nodejs-global-functions
-
发表评论
-
JavaScript之ECMAScript6新特性之_03_箭头函数(Arrow Function)
2018-01-25 13:46 1050一、简介 箭头函数(Arrow Function)是 ES6 ... -
JavaScript之ECMAScript6新特性之_02_线程异步阻塞: Promise, Async / await
2018-01-12 16:51 2253刚出来不久的 ES8 包含了 async 函数,它的出现,终于 ... -
JavaScript之ECMAScript6新特性之_01_开篇
2017-08-17 02:54 560点此查看全部: http://es6-features.org ... -
jQuery Versions - browser support
2017-08-12 04:19 1552jQuery 3.2.1 Support Deskto ... -
基于HTML5实现的中国象棋游戏
2017-06-24 02:24 1623HTML5实现中国象棋游戏 http://www.w2bc.c ... -
JavaScript之跨域请求解决方案
2017-06-07 11:03 3897浏览器处于安全原因,在使用 Ajax 进行请求访问时,不允许跨 ... -
JavaScript之 25 道面试题
2017-04-17 17:05 91325 Essential JavaScript Intervi ... -
JavaScript小应用之分页算法
2017-03-16 12:56 629效果图: function getPagina ... -
jQuery之empty() VS. remove()
2017-03-16 10:32 686jQuery empty() vs remove() Wh ... -
jQuery之 prop() VS. attr()
2017-03-14 16:43 624attr() 用于自定义属性,id ; prop() 用于 ... -
jQuery之mouseover,mouseover,mouseout,mouseleave
2017-03-14 10:20 618Jquery mouseenter() vs mouseove ... -
javascript之JS操作iframe
2017-02-28 14:56 2135JS操作iframe 1. 获得iframe的w ... -
javascript之面向对象编程之原型继承
2017-01-02 15:34 1041前文讲到“属性继承” ... -
HTML5之Cookie,localStorage 与 sessionStorage
2016-12-22 18:35 806详说 Cookie, LocalStorage 与 ... -
jquery之live(), delegate(), on() 方法
2016-11-26 23:48 882通过下面的一个实例理解 jQuery 的 live(), de ... -
javascript之小应用:网页在线聊天
2016-11-08 11:48 4212概览 这款使用 PHP 和 javascript 搭建的 ... -
javascript之编程序题目
2016-11-06 17:30 10021. 判断两个字符串是否:字母相同切长度相同(空格不算)。 ... -
javascript之面向对象编程之属性继承
2016-10-23 21:09 833函数继承可以分为两种:1、继承其 this 属性 2、继承其 ... -
javascript 之 undefined
2016-08-12 11:01 654一、用法 undefined 关键字有两种用法: 1. 如 ... -
javascript之 == vs ===
2016-06-12 15:59 623一、Comparison Overview 1. Speed ...
相关推荐
Cedar 是 Objective-C 上 BDD 风格的单元测试框架。describe(@"Example specs on NSString", ^{ it(@"lowercaseString returns a new string with everything in lower case", ^{ [@"FOOBar" ...
与TDD学习通过单元测试学习Javascript和框架。入门先决条件安装NodeJS 下载/克隆使用Git克隆仓库: git clone https://github.com/HenriqueLimas/learn-with-tdd.git 或者,您可以此存储库。建造从项目的根目录安装...
测试它 测试-这是一个结合了最好的节点和浏览器的测试框架。 特征 您的测试可以完全访问Real DOM...在像这样的节点之上构建的测试框架中运行时,您无权访问诸如window和document类的真实DOM API。 一些测试框架(包括
Kiwi 是 Objective-C 的单元测试框架,因其简单的接口而著名,基于 Objective-C 编写,只支持 iOS 应用 示例代码: describe(@"Team", ^{ context(@"when newly created", ^{ it(@"should have a name", ^{ ...
Cavy是针对React Native的跨平台集成测试框架。 Cavy测试允许您以编程方式与应用程序中深层嵌套的组件进行交互。 用纯JavaScript编写测试,然后在Android和iOS上运行它们。 豚鼠测试如下所示: export default ...
概念基于NPM / CommonJS的插件系统可插入任何JavaScript测试框架摩卡集成已准备就绪用法$ npm install tastespoon --save-dev与Docker和Mocha一起运行$ npm install mocha tastespoon --save-dev$ docker run -t -i ...
可定制的测试框架,用于构建您自己的测试框架。 基金会。 文件 治具 基本概念 Folio基于测试夹具的概念。 测试夹具用于为每个测试建立环境,为测试提供所需的一切,而没有其他任何东西。 这是传统BDD和基于夹具的...
Nemo 功能测试框架的定位器和操作 用法 将此添加到您的 package.json "nemo-shared-objects" : "~0.0.1" 按照 npm 错误的指示添加任何其他 nemo-* 插件(如果遇到) 这是一个示例规范 /*global describe:true, ...
用于测试Javascript代码的BDD框架 没有任何依赖关系(您不需要jQuery或Underscore) 不需要DOM即可运行(您可以从终端运行Jasmine) 测试套件 用于对实体的测试进行分组,例如类,构造函数,Angular指令,控制器,...
ts'describe('A test suite',()=> {it('should sum a + b',()=> {Expect(1 + 2).toBe(3)})})run()//启动测试运行程序,然后运行:deno test -q输出:/home/v1rtl/Coding/deno-libs/wizard/mod.ts
是一个JavaScript框架,它使您的测试看起来很棒: describe("titanium-jasmine", function() { it("should help you develop titanium applications", function() { expect(yourTests).toBe('awesome'); });}); ...
Sleipnir 是 BDD 风格的 Swift 框架,灵感来源于Cedar。 示例: class SampleSpec : SleipnirSpec { var spec : () = describe("Horse") { context("usual") { it("is not awesome") { ...
PB describe Evaluate LookUpDisplay用法,仅供参考!
Kahlan是RSpec / JSpec的功能齐全的Unit&BDD测试框架,它使用describe-it语法并将PHP中的测试向前推进了一步。 Kahlan使您可以像在Ruby或JavaScript中一样直接对代码进行存根或猴子修补,而无需任何必需的PECL扩展...
Kahlan是RSpec / JSpec的功能齐全的Unit&BDD测试框架,它使用describe-it语法并将PHP中的测试向前推进了一步。 Kahlan使您可以像在Ruby或JavaS中一样直接对代码进行存根或猴子补丁。Kahlan是RSpec / JSpec的功能...
方便的单元测试框架。 Utility Testing 提供直观的界面、简单的测试结构、异步代码处理机制、彩色报告、详细程度控制等。 使用该模块摆脱可以自动化的例程。 为什么要测试? 简单的测试语法 测试用例的简单分组 ...
var d = require ( 'describe-property' ) ; function Person ( firstName , surname ) { this . firstName = firstName ; this . surname = surname ; } Object . defineProperties ( Person . prototype , { /...
视觉回归测试框架 关于 Vizard使用Puppeteer生成并比较您的应用程序的屏幕截图。 这对于在组件库中自动检测视觉回归非常方便。 例子 常见用法如下: 编写测试用例 您有一个名为my-button.viz.js的文件: describe ...
它是一个库,用于使用任何测试框架来检查TypeScript&JavaScript项目中的体系结构约定。 您检查文件,文件夹和片之间的依赖关系,检查循环依赖关系等等。 它类似于ArchUnit,但适用于TS / JS项目。 建置状态 安装 ...
爱你的测试框架。 通过始终通过您编写的每个测试来提高您的士气,请先尝试! 永远不要再次失败。 再也不会看到那些让你想用头敲键盘的可怕的红色字母了。 npm install lust var describe = require ( "lust" ) ;...