更新:似乎这是一个错误的吞咽量角器。在他们的github页面上,他们将其归档为一个bug,并将对其进行查看。来源:https://github.com/mllrsohn/gulp-protractor/issues/64
在错误被解决之前,唯一可行的解决办法是将项目的目录更改为不包含空格的内容。
因此,我试图让一个Aurelia项目开始,包括前端单元测试。问题就从这里开始。当我尝试运行e2e gulp任务时,会得到以下错误:
10:45:44使用gulpfile ~\Documents\Visual 2013\Projects\ProjectX\ProjectX\gulpfile.js 10:45:44开始“构建-e2e”. 10:45:44在207 ms后完成“build-e2e” 10:45:44开始“e2e” 'C:\Users\jorisd\Documents\Visual‘不能识别为内部或外部命令、可操作的程序或批处理文件。C:\\jorisd\\Visual 2013\Projects\ProjectX\ProjectX\build\tasks\e2e.js:34 .on(“错误”,函数(E){抛e;});错误:代码1退出量角器
基本上,有问题的是突出显示的代码。因为我的路径包含一个空间,它会因为某种原因而停在那里。
下面是我的e2e.js文件现在的样子:
var gulp = require('gulp');
var paths = require('../paths');
var to5 = require('gulp-babel');
var plumber = require('gulp-plumber');
var webdriverUpdate = require('gulp-protractor').webdriver_update;
var webdriverStandalone = require("gulp-protractor").webdriver_standalone;
var protractor = require('gulp-protractor').protractor;
// for full documentation of gulp-protractor,
// please check https://github.com/mllrsohn/gulp-protractor
gulp.task('webdriver-update', webdriverUpdate);
gulp.task('webdriver-standalone', ['webdriver-update'], webdriverStandalone);
// transpiles files in
// /test/e2e/src/ from es6 to es5
// then copies them to test/e2e/dist/
gulp.task('build-e2e', function() {
return gulp.src(paths.e2eSpecsSrc)
.pipe(plumber())
.pipe(to5())
.pipe(gulp.dest(paths.e2eSpecsDist));
});
// runs build-e2e task
// then runs end to end tasks
// using Protractor: http://angular.github.io/protractor/
gulp.task('e2e', ['build-e2e'], function(cb) {
return gulp.src(paths.e2eSpecsDist + '/*.js')
.pipe(protractor({
configFile: '/protractor.conf.js',
args: ['--baseUrl', 'http://127.0.0.1:9000']
}))
.on('end', function() { process.exit(); })
.on('error', function(e) { throw e; });
});问题是将e2e任务与configFile选项放在一起。
我尝试将这一行更改为:
configFIle: __dirname + '/protractor.conf.js',但这也没有结果。如果你们中有人知道在configFile路径中包含空格的解决办法,我会很高兴听到的。
发布于 2017-05-15 11:20:37
对我来说很好。
var angularProtractor = require('gulp-angular-protractor');
gulp.task('test', function (callback) {
gulp
.src([__dirname+'/public/apps/adminapp/**/test/**_test.js'])
.pipe(angularProtractor({
'configFile': 'public/apps/adminapp/app.test.config.js',
'debug': false,
'args': ['--suite', 'adminapp'],
'autoStartStopServer': true
}))
.on('error', function(e) {
console.log(e);
})
.on('end',callback);});
https://stackoverflow.com/questions/34130815
复制相似问题