Typescript + Gulp + Protractor =>找不到模块config.js

时间:2017-02-18 12:59:35

标签: javascript typescript gulp gulp-protractor

我正在尝试使用gulp来运行量角器。我能够运行前两个任务,但是当我尝试运行第三个任务时,它无法找到存储在下面路径中的config.js文件( Windows系统

F:\ Selenium2 \量角器\ TypeScriptProject \ ConvertedJSFiles \配置\ config.js

gulpfile.js

from django.conf.urls import url
from . import views
from django.views.generic import TemplateView

urlpatterns = [
    url(r'^scoreresults$', TemplateView.as_view(template_name='registration/accounts/results.html'),
        name='tcresults'),
]

控制台错误

import * as gulp from 'gulp';
import * as protractor from 'gulp-protractor';

gulp.task('webdriver-update', protractor.webdriver_update);
gulp.task('webdriver-standalone', protractor.webdriver_standalone);
gulp.task('run-prot', function () {
    console.log('About to run the specs...........')

    gulp.src(['ConvertedJSFiles/specs/*.js']).pipe(protractor.protractor({
            configFile: 'ConvertedJSFiles/config/config.js'
    })).on('error',function(e){
            throw e;

    });
});
console.log(protractor.getProtractorDir() + ' is the protractor directory ***');

1 个答案:

答案 0 :(得分:0)

问题是错误的目录引用。我使用" path"进行了调试。包。下面是更新的文件。

import * as gulp from 'gulp';
import * as protractor from 'gulp-protractor';
import * as path from 'path';
gulp.task('webdriver-update', protractor.webdriver_update);
gulp.task('webdriver-standalone', protractor.webdriver_standalone);
gulp.task('run-prot', function () {
    console.log('About to run the specs...........')
    let srcfiles=path.resolve('../specs/*.js');
    console.log(srcfiles);
    gulp.src([srcfiles]).pipe(protractor.protractor({
            configFile: '../config/config.js'
    })).on('error',function(e){
            throw e;

    });
});
console.log(protractor.getProtractorDir() + ' is the protractor directory ***');