“TypeError:deps.map不是函数”在resolveDepMaps()node_modules / dojo / dojo.js [英] "TypeError: deps.map is not a function" in resolveDepMaps() of node_modules/dojo/dojo.js

查看:206
本文介绍了“TypeError:deps.map不是函数”在resolveDepMaps()node_modules / dojo / dojo.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在改变我的组织底层基础设施,将自动化测试从浏览器客户端运行,使用单独的Web服务器运行在测试运行器(intern-runner)中。在测试环境中,事情一直在膨胀 - 我已经遇到了一大堆问题,但是随之而来的是繁荣!有人下载一个新的单元测试,在浏览器客户端运行得很好,但是当我用测试运行器运行它时,我收到这个错误:

I've been changing my org's underlying infrastructure to switch our automated tests from running in browser client using a separate web server to running in the test runner (intern-runner). In the test runner environment, things had been going swell--I'd gotten past a ton of issues, but then boom! Someone drops a new unittest, that runs just fine in the browser client, but then when I run it with test runner, I get this error:

! TypeError:deps.map不是 http://9.77.140.51中的函数:9000 / __ intern / node_modules / dojo / dojo.js:678

! TypeError: deps.map is not a function at http://9.77.140.51:9000/__intern/node_modules/dojo/dojo.js:678

dojo.js中的678行是这样的:

Line 678 in dojo.js is this:

resolveDeps = function (deps, module, referenceModule) {
    // resolve deps with respect to this module
    return deps.map(function (dep, i) {   // <-- Line 678!
        var result = getModule(dep, referenceModule);
        if (result.fix) {
            result.fix = function (m) {
                module.deps[i] = m;
            };
        }
        return result;
    });
},

根本没有更改此文件。我不知道resolveDeps()函数做什么或什么是deps。

I have not changed this file at all. I have no idea what that resolveDeps() function does or what a "deps" is.

我没有看到任何异常的这个新测试正在做,没有什么从数百个其他通过的测试非常出色(但是我没有写它)。浏览器客户端报告没有错误。当运行测试运行器时,引导开发者工具查看控制台不提供任何有意义的信息,因为TypeError似乎杀死HTTP代理服务器,浏览器控制台只显示一堆404,这似乎是红色的herrings,因为服务器已经停止了。

I don't see anything unusual that this new test is doing, nothing really extraordinary from the hundreds of other tests that pass just fine (however, I did not write it). Browser client reports no errors. When running with test runner, bringing up the developer tool to look at the console provides no meaningful info, as the TypeError seems to kill the HTTP proxy server and the browser console just shows a bunch of 404s, which seems like red herrings because the server was stopped.

任何人都有任何线索?

推荐答案

可能是由于格式不正确的测试模块,尽管很难说没有更多的信息。在加载程序的依赖关系解析代码中出现错误,该代码在定义 require 语句时起作用。 Dojo的定义函数了解4个参数配置:

This is likely due to an improperly formatted test module, although it's hard to say without more information. The error is occurring in the loader's dependency resolution code, which comes into play for define and require statements. Dojo's define function understands 4 argument configurations:


  1. define (id,deps,callback)

  2. define(deps,callback)

  3. define(callback)

  4. define(object)

  1. define(id, deps, callback)
  2. define(deps, callback)
  3. define(callback)
  4. define(object)

id 是一个字符串, deps 是一个数组。)如果由于某种原因,你有一个使用格式 define(id,callback)的模块,你会得到错误'看到,因为装载器中的依赖关系解析代码会将第一个或第二个参数作为一个数组。

(id is a string and deps is an array.) If for some reason you had a module that used the format define(id, callback), you'd get the error you're seeing because the dependency resolution code in the loader expects either the first or second parameter to be an array.

这篇关于“TypeError:deps.map不是函数”在resolveDepMaps()node_modules / dojo / dojo.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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