无法将ts编译为js,找不到模块“量角器”

时间:2018-11-05 12:00:15

标签: javascript typescript protractor

无法将ts编译为js,找不到模块“量角器” 我已经在本地安装了量角器,打字稿,茉莉花。

src
项目/量角器
项目/测试
项目/页面(从“量角器”导入{ElementFinder,浏览器,元素,作者,量角器};)
规格

tsconfig.js

{
    "compilerOptions": {
        "sourceMap": false,
        "target": "es6",
        "moduleResolution": "node"
        "baseUrl": ".",
         "paths": {
             "protractor": [
                 "./projects"
             ]
         },
         "traceResolution": true
    },
    "module": "commonjs",
    "include": [
        "./Swc.Portal.Site/**/*.ts"
    ],
    "exclude": [
        "node_modules"
    ]
}

protractorConf.js

exports.config = {
    seleniumServerJar: 'node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-2.47.1.jar',
    chromeDriver: 'node_modules/chromedriver/chromedriver',
    allScriptsTimeout: 20000,

    capabilities: {
        'browserName': 'chrome'
    },

    framework: 'jasmine2',

    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 90000
    },

    onPrepare: function() {
        var specs = browser.params.specs;
        let globals = require('protractor');
        let browser = globals.browser;
            browser.driver.manage().window().maximize();
    }
};

我不能将量角器与测试放在同一目录中,我需要解决导入不相关路径的问题

1 个答案:

答案 0 :(得分:0)

您对量角器有误path。如果在本地安装,则protractor应该位于项目根目录下的/node_modules中。例如:

my_project/node_modules/protractor