Javascript 实习生-引用错误:未定义文档

Javascript 实习生-引用错误:未定义文档,javascript,node.js,intern,Javascript,Node.js,Intern,当我试图从测试文件目录中运行实习生测试时,看到此错误消息。dir的(相关)结构为: 试验 资源 休息 皮卡 cashManagement.js gitignore 实习医生 packages.js packages.sample.js inter.js在suites部分包含对testFile1.js和testFile2.js的引用。我对这两个文件的引用方式做了一些修改,并出现了“加载模块失败…”错误。所以我想现在这

当我试图从测试文件目录中运行实习生测试时,看到此错误消息。dir的(相关)结构为:

  • 试验
    • 资源
      • 休息
        • 皮卡
        • cashManagement.js
      • gitignore
      • 实习医生
      • packages.js
      • packages.sample.js
inter.js在suites部分包含对testFile1.js和testFile2.js的引用。我对这两个文件的引用方式做了一些修改,并出现了“加载模块失败…”错误。所以我想现在这已经解决了,引用错误是我需要弄清楚的。我确实检查了现有的线程,但似乎没有解决我的问题。完整的错误消息粘贴在下面。如果需要,我很乐意提供更多相关信息

谢谢, 埃兰

以下是intern.js文件的内容:

// Learn more about configuring this file at <https://github.com/theintern/intern/wiki/Configuring-Intern>.
// These default settings work OK for most people. The options that *must* be changed below are the
// packages, suites, excludeInstrumentation, and (if you want functional tests) functionalSuites.

serviceURL = "http://ovc.local:8080/POSMClient/json/process/execute/";


define(['./packages'], function(Packages) {

    var returnValue = {
        // Configuration options for the module loader; any AMD configuration options supported by the specified AMD loader
        // can be used here
        loader: {
            packages: Packages.packages
        },

        // The port on which the instrumenting proxy will listen
        proxyPort: 9000,

        // A fully qualified URL to the Intern proxy
        proxyUrl: 'http://localhost:9000/',

        // Default desired capabilities for all environments. Individual capabilities can be overridden by any of the
        // specified browser environments in the `environments` array below as well. See
        // https://code.google.com/p/selenium/wiki/DesiredCapabilities for standard Selenium capabilities and
        // https://saucelabs.com/docs/additional-config#desired-capabilities for Sauce Labs capabilities.
        // Note that the `build` capability will be filled in with the current commit ID from the Travis CI environment
        // automatically
        capabilities: {
            'selenium-version': '2.39.0'
        },

        // Browsers to run integration testing against. Note that version numbers must be strings if used with Sauce
        // OnDemand. Options that will be permutated are browserName, version, platform, and platformVersion; any other
        // capabilities options specified for an environment will be copied as-is
        environments: [/*
         { browserName: 'internet explorer', version: '11', platform: 'Windows 8.1' },
         { browserName: 'internet explorer', version: '10', platform: 'Windows 8' },
         { browserName: 'internet explorer', version: '9', platform: 'Windows 7' },
         { browserName: 'firefox', version: '27', platform: [ 'OS X 10.6', 'Windows 7', 'Linux' ] },
         { browserName: 'chrome', version: '32', platform: [ 'OS X 10.6', 'Windows 7', 'Linux' ] },
         { browserName: 'safari', version: '6', platform: 'OS X 10.8' },
         { browserName: 'safari', version: '7', platform: 'OS X 10.9' }*/
        ],

        // Maximum number of simultaneous integration tests that should be executed on the remote WebDriver service
        maxConcurrency: 3,

        // Whether or not to start Sauce Connect before running tests
        useSauceConnect: false,

        // Connection information for the remote WebDriver service. If using Sauce Labs, keep your username and password
        // in the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables unless you are sure you will NEVER be
        // publishing this configuration file somewhere
        webdriver: {
            host: 'localhost',
            port: 4444
        },

        // The desired AMD loader to use when running unit tests (client.html/client.js). Omit to use the default Dojo
        // loader
        useLoader: {
            'host-node': 'dojo/dojo',
            'host-browser': 'node_modules/dojo/dojo.js'
        },

        // Non-functional test suite(s) to run in each browser
        suites: [
            "rest/pickup",
            "rest/cashManagement"
        ],

        // Functional test suite(s) to run in each browser once non-functional tests are completed
        functionalSuites: [ /* 'myPackage/tests/functional' */ ],

        // A regular expression matching URLs to files that should not be included in code coverage analysis
        excludeInstrumentation: /^tests\//
    }

    return returnValue;
});
//了解有关在上配置此文件的详细信息。
//这些默认设置对大多数人都适用。以下*必须*更改的选项为
//软件包、套件、排除仪器和(如果需要功能测试)功能套件。
服务URL=”http://ovc.local:8080/POSMClient/json/process/execute/";
定义(['./包]],函数(包){
var返回值={
//模块加载器的配置选项;指定AMD加载器支持的任何AMD配置选项
//可以在这里使用
加载器:{
包:包。包
},
//检测代理将在其上侦听的端口
代理端口:9000,
//指向实习生代理的完全限定URL
proxyUrl:'http://localhost:9000/',
//所有环境的默认所需功能。任何
//在下面的“环境”数组中也指定了浏览器环境。请参阅
// https://code.google.com/p/selenium/wiki/DesiredCapabilities 用于标准Selenium功能和
// https://saucelabs.com/docs/additional-config#desired-酱汁实验室的功能。
//请注意,“build”功能将由Travis CI环境中的当前提交ID填充
//自动地
能力:{
“selenium版本”:“2.39.0”
},
//要对其运行集成测试的浏览器。请注意,如果与Sauce一起使用,则版本号必须是字符串
//将被置换的选项是browserName、version、platform和platformVersion;任何其他
//为环境指定的功能选项将按原样复制
环境:[/*
{browserName:'internet explorer',版本:'11',平台:'Windows 8.1'},
{browserName:'internet explorer',版本:'10',平台:'Windows 8'},
{browserName:'internet explorer',版本:'9',平台:'Windows 7'},
{browserName:'firefox',版本:'27',平台:['OSX10.6','Windows7','Linux']},
{browserName:'chrome',版本:'32',平台:['OSX10.6','Windows7','Linux']},
{browserName:'safari',版本:'6',平台:'OSX10.8'},
{browserName:'safari',版本:'7',平台:'OSX10.9'}*/
],
//应在远程WebDriver服务上执行的最大同时集成测试数
最大并发:3,
//在运行测试之前是否启动Sauce Connect
useSauceConnect:false,
//远程WebDriver服务的连接信息。如果使用Sauce Labs,请保留您的用户名和密码
//在SAUCE\u USERNAME和SAUCE\u ACCESS\u键环境变量中,除非您确定永远不会
//在某处发布此配置文件
网络驱动程序:{
主机:“localhost”,
港口:4444
},
//运行单元测试时所需的AMD加载程序(client.html/client.js)。省略使用默认的Dojo
//装载机
useLoader:{
“主机节点”:“dojo/dojo”,
“主机浏览器”:“节点\模块/dojo/dojo.js”
},
//要在每个浏览器中运行的非功能测试套件
套房:[
“休息/接送”,
“休息/现金管理”
],
//非功能测试完成后,在每个浏览器中运行的功能测试套件
功能套件:[/*'myPackage/tests/functional'*/],
//将URL与不应包含在代码覆盖率分析中的文件相匹配的正则表达式
不包括仪器:/^测试\//
}
返回值;
});

看起来您正在使用Dojo的发布版本,它假设
文档
对象将可用。要使用该版本,您需要使用
intern runner
或浏览器客户端(
client.html
)运行intern。如果您希望使用节点客户端(
intern-client
)运行测试,则需要使用Dojo的源代码发行版或Dojo npm包。

您还可以显示使用了什么配置吗?当然可以。你是指intern.js文件吗?在原始问题中添加了intern.js。(粘贴的JS格式有点混乱。它在“Here's content of the intern.JS file”行之后开始,在“returnValue;”行之后结束)。您如何运行intern?浏览器客户端、intern客户端或intern runner?我正在使用以下目录运行它:intern client config=intern.js非常感谢Jason。你知道我在哪里吗
// Learn more about configuring this file at <https://github.com/theintern/intern/wiki/Configuring-Intern>.
// These default settings work OK for most people. The options that *must* be changed below are the
// packages, suites, excludeInstrumentation, and (if you want functional tests) functionalSuites.

serviceURL = "http://ovc.local:8080/POSMClient/json/process/execute/";


define(['./packages'], function(Packages) {

    var returnValue = {
        // Configuration options for the module loader; any AMD configuration options supported by the specified AMD loader
        // can be used here
        loader: {
            packages: Packages.packages
        },

        // The port on which the instrumenting proxy will listen
        proxyPort: 9000,

        // A fully qualified URL to the Intern proxy
        proxyUrl: 'http://localhost:9000/',

        // Default desired capabilities for all environments. Individual capabilities can be overridden by any of the
        // specified browser environments in the `environments` array below as well. See
        // https://code.google.com/p/selenium/wiki/DesiredCapabilities for standard Selenium capabilities and
        // https://saucelabs.com/docs/additional-config#desired-capabilities for Sauce Labs capabilities.
        // Note that the `build` capability will be filled in with the current commit ID from the Travis CI environment
        // automatically
        capabilities: {
            'selenium-version': '2.39.0'
        },

        // Browsers to run integration testing against. Note that version numbers must be strings if used with Sauce
        // OnDemand. Options that will be permutated are browserName, version, platform, and platformVersion; any other
        // capabilities options specified for an environment will be copied as-is
        environments: [/*
         { browserName: 'internet explorer', version: '11', platform: 'Windows 8.1' },
         { browserName: 'internet explorer', version: '10', platform: 'Windows 8' },
         { browserName: 'internet explorer', version: '9', platform: 'Windows 7' },
         { browserName: 'firefox', version: '27', platform: [ 'OS X 10.6', 'Windows 7', 'Linux' ] },
         { browserName: 'chrome', version: '32', platform: [ 'OS X 10.6', 'Windows 7', 'Linux' ] },
         { browserName: 'safari', version: '6', platform: 'OS X 10.8' },
         { browserName: 'safari', version: '7', platform: 'OS X 10.9' }*/
        ],

        // Maximum number of simultaneous integration tests that should be executed on the remote WebDriver service
        maxConcurrency: 3,

        // Whether or not to start Sauce Connect before running tests
        useSauceConnect: false,

        // Connection information for the remote WebDriver service. If using Sauce Labs, keep your username and password
        // in the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables unless you are sure you will NEVER be
        // publishing this configuration file somewhere
        webdriver: {
            host: 'localhost',
            port: 4444
        },

        // The desired AMD loader to use when running unit tests (client.html/client.js). Omit to use the default Dojo
        // loader
        useLoader: {
            'host-node': 'dojo/dojo',
            'host-browser': 'node_modules/dojo/dojo.js'
        },

        // Non-functional test suite(s) to run in each browser
        suites: [
            "rest/pickup",
            "rest/cashManagement"
        ],

        // Functional test suite(s) to run in each browser once non-functional tests are completed
        functionalSuites: [ /* 'myPackage/tests/functional' */ ],

        // A regular expression matching URLs to files that should not be included in code coverage analysis
        excludeInstrumentation: /^tests\//
    }

    return returnValue;
});