4

may I ask you why my app works with ng serve and ng build but if I run protractor, my e2e test fails with this message?

[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)

Following the tsconfig.e2e

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

And this is my tsconfig.app

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

0 Answers0