量角器配置文件抛出错误
Protractor config file throws an error
我昨天运行使用了相同的规范-test.js 和config.js,并且工作正常。
今天我尝试了以下错误,这发生在 3 台机器中的 2 台上:
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
[launcher] Error: SyntaxError: Unexpected identifier
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Users/FOLDERPATH/specs/spec-test.js:2:13)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
[launcher] Process exited with error code 100
我正在使用量角器 3.2.2,节点 4.4.3
知道为什么测试没有执行。
PS: 请忽略任何文件名mismatch/typos,因为我已经稍微修改了我的代码以在论坛上提问。我尝试 运行 下面的代码,但看到了同样的错误。
config.js:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['specs/spec-test.js'],
capabilities: {
browserName: 'chrome',
chromeOptions: {
debuggerAddress: '127.0.0.1:9000'
}
},
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 700000,
isVerbose: true
}
};
规格-test.js
var fs = require('fs');
var panel = require('../pageObjects/file1.js');
var panelHelper = require('../pageObjects/file2.js');
var panelApp = require('../pageObjects/file3.js');
describe("Just print Hello world", function() {
it('test 1', function() {
console.log("Hello World!");
});
});
您肯定在其中一个 require
pageObject 文件中存在语法错误,例如缺少逗号或其他内容。我看不出你的配置有什么问题。此外,它启动 webDriver 实例的事实意味着它正在通过 onPrepare 并启动规范,因此它不是您的配置文件。
如果您的配置有问题,它会抛出不同的错误,即 ERROR - failed loading configuration file config/local.conf.js
。我会仔细查看那些 pageObject 文件是否有语法错误。
我昨天运行使用了相同的规范-test.js 和config.js,并且工作正常。
今天我尝试了以下错误,这发生在 3 台机器中的 2 台上:
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
[launcher] Error: SyntaxError: Unexpected identifier
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Users/FOLDERPATH/specs/spec-test.js:2:13)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
[launcher] Process exited with error code 100
我正在使用量角器 3.2.2,节点 4.4.3
知道为什么测试没有执行。
PS: 请忽略任何文件名mismatch/typos,因为我已经稍微修改了我的代码以在论坛上提问。我尝试 运行 下面的代码,但看到了同样的错误。
config.js:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['specs/spec-test.js'],
capabilities: {
browserName: 'chrome',
chromeOptions: {
debuggerAddress: '127.0.0.1:9000'
}
},
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 700000,
isVerbose: true
}
};
规格-test.js
var fs = require('fs');
var panel = require('../pageObjects/file1.js');
var panelHelper = require('../pageObjects/file2.js');
var panelApp = require('../pageObjects/file3.js');
describe("Just print Hello world", function() {
it('test 1', function() {
console.log("Hello World!");
});
});
您肯定在其中一个 require
pageObject 文件中存在语法错误,例如缺少逗号或其他内容。我看不出你的配置有什么问题。此外,它启动 webDriver 实例的事实意味着它正在通过 onPrepare 并启动规范,因此它不是您的配置文件。
如果您的配置有问题,它会抛出不同的错误,即 ERROR - failed loading configuration file config/local.conf.js
。我会仔细查看那些 pageObject 文件是否有语法错误。