Tag: 实习生

在一个registerSuite Intern.js里面不能要求AMD模块

我有一些我想要的代码: define(function(require) { return stuff { my_func: function() { return 1; } }; }); 我试图要求它在一个registerSuite里面。 registerSuite(function() { var navigation = require('path/to/navigation.js'); 'my test': function() { return navigation.my_func(); } }); 这给我一个错误的“my_func()”没有在导航中find。 我不得不将“包含”代码转换为一个类,并实例化一个对象来使其工作。 请求方式不工作有一个原因吗?

使用intern与systemjs

我目前正在考虑将实习生整合到一个更大的技术堆栈中,似乎被卡住了。 大多数情况下,我跟着这篇文章,介绍如何用InterntestingTypeScript 。 我开发使用nodejs和angularScript打字机转换到ES5。 模块格式是systemjs (不幸的是,在这个环境中是必须的)。 在实习文档中提到了testing其他模块types的东西,但是如果可能的话,我不确定如何使其适应我的需求。 如果我尝试通过手动require($module)来绕过systemjs,intern会不停地通知我缺less必需的模块(模块的依赖关系)。 我目前的tsconfig-options: "compilerOptions": { "module": "System", "target": "ES5", "sourceMap": true, "noEmitOnError": false, "outDir": "src/scripts/js" } 我留下了实习生的示例configuration几乎没有改变,虽然我添加了angular度模块的正式angular度示例testing。 任何提示或帮助,将不胜感激

实习生unit testing:加载需要浏览器上下文的模块

我已经为我们的控制器/路由器编写了简单的unit testing,但不能让他们通过实习运行..路由器模块需要加载其他模块,例如pace.js,在这个实例中,我需要将它添加到实习生的config文件作为loader / packages中的一个依赖项…然后加载Pace模块ok,但是实习生的runner失败,并且出现'Reference Error:window is not defined'。 步伐模块需要在浏览器中运行,但实习生似乎在节点上下文中运行它…我正在使用以下命令: node node_modules/intern/client.js config=test/intern 我试过这个答案 ,即。 从loader / packages中取出Pace模块,并且只有当intern在主机浏览器上下文时才添加testcase,但是实习者跳过我的testing用例,因为它不能进入​​if(has)块…这里是我添加到intern.js的代码: var suites = []; suites.push('test/unit/all'); if (has('host-browser')) { suites.push('test/unit/app/controller/Router'); } return { // … suites: suites, // … }; 实习生似乎将其上下文切换到节点,我怎样才能保持它在浏览器?

在Intern中调用柴插件返回错误

我试图在实习生中使用sinon-chai插件 ,但它给了我: Error {stack: (…), message: "Cannot find the Node.js require"} 我已经通过npm安装了插件,这里是我的testing文件: define([ 'intern!bdd', 'intern/chai!expect', 'app/functions', 'intern/chai', 'intern/dojo/node!sinon-chai' ], function (bdd, expect, myapp, chai, sinonChai) { chai.use(sinonChai); … }); 什么可能会出错?

如何纠正在fixdeps.js中的Intern npm安装失败

尝试安装实验室testing框架时出现以下错误。 我已经尝试清除npmcaching,重新启动机器等错误说已存在的文件不存在。 这是否可能与我正在运行节点v0.11.13的事实? 我知道一些软件包不能用于.10.xx以上的任何内容。 或者,也许这是别的? > intern@2.1.1 install C:\Program Files\nodejs\node_modules\intern > node support/fixdeps.js fs.js:755 return binding.symlink(preprocessSymlinkDestination(destination, type), ^ Error: EEXIST, file already exists 'C:\Program Files\nodejs\node_modules\intern\ node_modules\dojo' at Error (native) at Object.fs.symlinkSync (fs.js:755:18) at C:\Program Files\nodejs\node_modules\intern\support\fixdeps.js:27:6 at Array.forEach (native) at Object.<anonymous> (C:\Program Files\nodejs\node_modules\intern\support\f ixdeps.js:8:20) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:349:32) at Function.Module._load (module.js:305:12) […]

使用PhantomJS和Travis CI运行实习生testing

语境: 我正在使用Intern框架运行一些unit testing。 由于我testing的代码是我在NPM上发布的一个包,我想将它与Travis CI集成。 在我的本地,所有的testing运行良好。 但是,使用Travis CI,testing因为启动PhantomJSnetworking服务器而停滞不前。 这是我的Travis CI文件: language: node_js node_js: – "4" env: – CXX=g++-4.8 addons: apt: sources: – ubuntu-toolchain-r-test packages: – g++-4.8 before_script: – bower install – npm install grunt-cli -g – grunt installation – phantomjs –webdriver=4444 因为phantomjs命令启动了一个web服务器,所以它永远不会运行npm test 。 它只是暂停在networking服务器上。 题: 启动PhantomJS后,如何进行npm test ? 有什么方法可以将该过程移到后台,还是启动另一个过程来运行我的testing? 还是有一种方式调用phantomjs –webddriver=444和intern-runner config=tests/intern在同一时间?

在实习生testing中包含jQuery

我如何testing自定义的JavaScript应用程序(包括jQuery作为依赖)? 我已经试过jQuery的Node包没有成功… 我是否需要在testing套件依赖项中以某种方式定义它? 我试过这个: define([ 'intern!bdd', 'intern/chai!expect', 'node-jquery' ], …

实习生asynchronous调用之前()

我需要请求一些包含用于testing的数据的json文件。 我想在设置方法中提出请求,但是没有附加的asynchronous方法。 当我运行下面的代码时,testinglogin函数内部的日志被发送到控制台,然后我的日志从安装方法发送。 有没有一种方法可以告诉设置在运行testing之前等待我的电话完成? define([ 'intern!object', 'pages/LoginPage', 'data-objects/DataFetcher' ], function(registerSuite, LoginPage, DataFetcher) { registerSuite(function() { var loginId = admin; var password = test; var regionData = US; var loginPage = null; return { name: 'Login test', setup: function() { // Initialize page objects loginPage = new LoginPage(this.remote, this.timeout); // get test data DataFetcher.getData(Pages.LoginPage).then(function(response) { logger.info(DataFetcher.generateData(response)); […]

实习生与Visual Studio 2013集成

环境 我们目前在Visual Studio 2013 Update 4中使用了2个Chutzpah包( 这个和这个 ),使我们能够针对我们正在开发的angular度应用程序执行单独的Jasmineunit testing(Chutzpah上下文菜单“在浏览器中打开”)。 我们目前必须使用Chrome开发人员工具来设置断点并debuggingunit testing。 目前的Jenkins构build运行Moqunit testing对C#应用程序代码和SauceLabs跨浏览器seleniumtesting。 JStesting的下一步是将它们作为Jenkins构build的一部分与其他testing一起执行。 为了实现这个目前最好的工具是实习生 。 我们的要求 执行JStesting并将计算覆盖范围作为Jenkins在SauceLab上构build的一部分。 执行并逐步(debugging)JSunit testing 关于1,我可以从Intern的例子中看到,我们可能必须(可以)重写我们的Interntesting,让它们在Jenkins和SauceLabs上执行。 关于2,这篇文章的重点: 我的问题 可以使用开发人员工具在Chrome中debugging以Intern示例的方式编写的testing吗? 是否需要类似Chutzpah的工具来将Visual Studio与Intern集成? ( 这是类似的工具吗?)

实习生 – ReferenceError:文档没有定义

当我试图从我的testing文件目录运行实习生testing时看到这个错误消息。 目录的(相关)结构是: testing 资源 rest pickup.js cashManagement.js gitignore intern.js packages.js packages.sample.js … inter.js在suite部分包含对testFile1.js和testFile2.js的引用。 我玩这两个文件被引用的方式,并得到了一个“无法加载模块…”的错误。 所以我想现在已经解决了,ReferenceError是我需要弄清楚的。 我确实去了现有的线程,似乎没有任何解决我的问题。 完整的错误信息被粘贴在下面。 如果需要,我会很乐意提供更多的相关信息。 谢谢,Eran ***ReferenceError: document is not defined** at /Applications/dojo-release-1.10.2/dojo/has.js:31:33 at execModule (/Users/eranbrand/src/MobilePosSolution/ovc-build/ovc-repo/src/test/node_modules/intern/node_modules/dojo/dojo.js:515:54) at /Users/eranbrand/src/MobilePosSolution/ovc-build/ovc-repo/src/test/node_modules/intern/node_modules/dojo/dojo.js:504:12 at Array.map (native) at execModule (/Users/eranbrand/src/MobilePosSolution/ovc-build/ovc-repo/src/test/node_modules/intern/node_modules/dojo/dojo.js:499:17) at /Users/eranbrand/src/MobilePosSolution/ovc-build/ovc-repo/src/test/node_modules/intern/node_modules/dojo/dojo.js:582:7 at guardCheckComplete (/Users/eranbrand/src/MobilePosSolution/ovc-build/ovc-repo/src/test/node_modules/intern/node_modules/dojo/dojo.js:566:4) at checkComplete (/Users/eranbrand/src/MobilePosSolution/ovc-build/ovc-repo/src/test/node_modules/intern/node_modules/dojo/dojo.js:574:27) at onLoadCallback (/Users/eranbrand/src/MobilePosSolution/ovc-build/ovc-repo/src/test/node_modules/intern/node_modules/dojo/dojo.js:656:7) at /Users/eranbrand/src/MobilePosSolution/ovc-build/ovc-repo/src/test/node_modules/intern/node_modules/dojo/dojo.js:761:5* 以下是intern.js文件的内容: // Learn more about […]