首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Intern中加载领导脚模块会产生一个错误

在Intern中加载领导脚模块会产生一个错误
EN

Stack Overflow用户
提问于 2014-09-03 03:48:07
回答 1查看 746关注 0票数 1

铅脚是作为实习生框架(./node_modules/intern/node_modules/leadfoot)的一部分安装的。但是,当我尝试像在文档(https://theintern.github.io/leadfoot/pollUntil.html)中那样使用它时:

代码语言:javascript
复制
define([
    'intern!object',
    'intern/chai!assert',
    'require'
], function (registerSuite, assert, require) {
    var url = '../../index.html';
    var Command = require('leadfoot/Command');
    var pollUntil = require('leadfoot/helpers/pollUntil');

    registerSuite({
        name: 'Todo (functional)',

        'submit form': function () {
            return this.remote.get(require.toUrl(url))
                .findById('new-todo').then(function (val) {}, function(err) {
                     console.log(err);
                }).click();
        }
    });
}

我得到以下错误:

代码语言:javascript
复制
$ intern-runner config=tests/example_intern
Listening on 0.0.0.0:9000
Starting tunnel...
Error: Attempt to require unloaded module leadfoot/Command
  at contextRequire  <node_modules/intern/node_modules/dojo/dojo.js:255:12>
  at module.require.result  <node_modules/intern/node_modules/dojo/dojo.js:284:13>
  at </home/bogdanbiv/WebstormProjects/life-tracker3/dojo-example/tests/functional/Todo.js:9:16>
  at execModule  <node_modules/intern/node_modules/dojo/dojo.js:515:54>
  at <node_modules/intern/node_modules/dojo/dojo.js:504:12>
  at Array.map  <native>
  at execModule  <node_modules/intern/node_modules/dojo/dojo.js:499:17>
  at <node_modules/intern/node_modules/dojo/dojo.js:582:7>
  at guardCheckComplete  <node_modules/intern/node_modules/dojo/dojo.js:566:4>
  at checkComplete  <node_modules/intern/node_modules/dojo/dojo.js:574:27>

有人能解释一下如何在功能测试中正确地使用先脚吗?

插入建议的修改:

代码语言:javascript
复制
$ intern-runner config=dojo-example/tests/intern
Listening on 0.0.0.0:9000
Starting tunnel...
Error: Failed to load module leadfoot/helpers/pollUntil from /home/bogdanbiv/WebstormProjects/life-tracker3/leadfoot/helpers/pollUntil.js (parent: dojo-example/tests/functional/Todo)
  at <node_modules/intern/node_modules/dojo/dojo.js:757:12>
  at <fs.js:207:20>

在Object.oncomplete

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-09-03 09:15:25

尝试将铅脚模块id放在define数组中而不是requiring数组中。

代码语言:javascript
复制
define([
    'intern!object',
    'intern/chai!assert',
    'require',
    'intern/dojo/node!leadfoot/Command',
    'intern/dojo/node!leadfoot/helpers/pollUntil'
], function (registerSuite, assert, require, Command, pollUntil) {
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25635913

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档