量角器+角度6库抛出错误:ReferenceError:窗口未定义

时间:2018-08-29 14:46:18

标签: protractor angular-cli ng-packagr

我可以问你为什么我的应用程序可以与ng serve和ng build一起使用,但是如果我运行量角器,则此消息将导致e2e测试失败?

[16:35:07] I/launcher - Running 1 instances of WebDriver
[16:35:07] I/direct - Using ChromeDriver directly...
[16:35:13] E/launcher - Error: ReferenceError: window is not defined
    at Object.<anonymous> (\node_modules\ngx-bootstrap\bundles\webpack:\ngx-bootstrap.umd\webpack\universalModuleDefinition:10:2)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at \dist\sg-ng-core-components\bundles\sg-ng-core-components.umd.js:2:268
    at Object.<anonymous> (\dist\sg-ng-core-components\bundles\sg-ng-core-components.umd.js:5:2)

遵循tsconfig.e2e

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/e2e",
    "module": "commonjs",
    "target": "es2017",
    "types": [
      "jasmine",
      "node"
    ]
  }
}

这是我的tsconfig.app

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "module": "es2015",
    "baseUrl": "",
    "types": [
      "node"
    ]
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

0 个答案:

没有答案