wallabyjs / public

Repository for Wallaby.js questions and issues
http://wallabyjs.com
760 stars 45 forks source link

Runtime error: ReferenceError: window is not defined #2648

Closed Beauceron closed 3 years ago

Beauceron commented 3 years ago

Hi, I have a problem with the automatic configuration using Intellij on my single repos multiple angular elements. I have all the latest update.

Here the error log :

wallaby.js started
core v1.0.1040
Angular CLI automatic configuration: Wallaby.js cannot use C:/git_repos/ui/apps/dmb/src/test.ts file, the standard test bed initialization code will be used instead. Please let us know if this is an issue for you at https:/github.com/wallabyjs/public/issues.
Runtime error: ReferenceError: window is not defined
    at WebSocket.emit (events.js:315:20)
    at afterWrite (_stream_writable.js:466:5)
    at onwrite (_stream_writable.js:446:7)
    at InflateRaw.afterTransform (_stream_transform.js:103:3)
    at Zlib.processCallback (zlib.js:587:8)

If the needed i will provide the full diagnostic report by email.

  editorVersion: 'IntelliJ IDEA 2020.3.2',
  pluginVersion: '1.0.212',
  editorType: 'IntelliJ',
  osVersion: 'win32 10.0.19041',
  nodeVersion: 'v14.15.0',
  coreVersion: '1.0.1040',

  ...

  packageJSON: {
    dependencies: {
      '@angular/animations': '11.2.0',
      '@angular/cdk': '11.2.0',
      '@angular/common': '11.2.0',
      '@angular/compiler': '11.2.0',
      '@angular/core': '11.2.0',
      '@angular/elements': '11.2.0',
      '@angular/forms': '11.2.0',
      '@angular/platform-browser': '11.2.0',
      '@angular/platform-browser-dynamic': '11.2.0',
      '@angular/router': '11.2.0',
      '@ngneat/transloco': '2.20.0',
      '@ngrx/effects': '11.0.1',
      '@ngrx/store': '11.0.1',
      '@ngrx/store-devtools': '11.0.1',
      '@webcomponents/custom-elements': '1.3.0',
      '@webcomponents/shadycss': '1.9.2',
      '@webcomponents/shadydom': '1.6.1',
      '@webcomponents/template': '1.4.1',
      color: '3.1.2',
      'core-js': '3.6.5',
      'css-vars-ponyfill': '2.1.2',
      'document-register-element': '1.13.1',
      'elements-zone-strategy': '10.0.0',
      lodash: '4.17.20',
      'lpcmedia-angular-testing-library': '0.0.1',
      mime: '2.4.6',
      'mime-db': '1.44.0',
      'mime-types': '2.1.27',
      moment: '2.27.0',
      'moment-timezone': '0.5.31',
      'ngrx-store-freeze': '0.2.4',
      'resize-observer-polyfill': '1.5.1',
      rxjs: '6.6.3',
      'terser-webpack-plugin': '^2.2.1',
      tslib: '^2.0.0',
      'web-animations-js': '^2.3.2',
      'zone.js': '0.11.3'
    },
    devDependencies: {
      '@angular-builders/custom-webpack': '11.0.0',
      '@angular-devkit/build-angular': '0.1102.0',
      '@angular/cli': '11.2.0',
      '@angular/compiler-cli': '11.2.0',
      '@angular/language-service': '11.2.0',
      '@nrwl/angular': '11.2.12',
      '@nrwl/cli': '11.2.12',
      '@nrwl/tao': '11.2.12',
      '@nrwl/workspace': '11.2.12',
      '@types/googlemaps': '3.39.13',
      '@types/jasmine': '3.5.11',
      '@types/jasminewd2': '2.0.3',
      '@types/node': '13.13.5',
      'angular2-template-loader': '0.6.2',
      codelyzer: '6.0.0',
      concat: '1.0.3',
      'fs-extra': '8.1.0',
      'http-server': '0.11.1',
      'jasmine-core': '~3.6.0',
      'jasmine-spec-reporter': '~5.0.0',
      jest: '^26.6.3',
      karma: '6.0.1',
      'karma-chrome-launcher': '3.1.0',
      'karma-coverage': '2.0.3',
      'karma-jasmine': '4.0.1',
      'karma-jasmine-html-reporter': '1.5.4',
      'karma-mocha-reporter': '2.2.5',
      'karma-teamcity-reporter': '1.1.0',
      'moment-random': '1.1.0',
      'node-sass': '4.14.1',
      prettier: '2.1.1',
      puppeteer: '5.5.0',
      replace: '1.1.1',
      'rxjs-tslint-rules': '4.34.1',
      'ts-node': '9.1.1',
      tslib: '2.0.0',
      tslint: '6.1.3',
      'tslint-etc': '1.13.7',
      typescript: '4.1.3',
      'wallaby-webpack': '3.9.15',
      'webpack-bundle-analyzer': '3.3.2'
    }

    ...

  debug: [
    '2021-03-03T16:44:01.143Z angular/cli config Detected Angular CLI.
',
    '2021-03-03T16:44:03.455Z angular/cli karma workspace config Using default C:\git_repos\ui\test.workspace.ts.
',
    '2021-03-03T16:44:03.457Z angular/cli karma workspace config Using virtual C:/git_repos/ui/libs/elements-broadcaster/src/test.ts.
',
    '2021-03-03T16:44:03.457Z angular/cli karma workspace config Using virtual C:\git_repos\ui\tsconfig.wallaby.spec.json.
',
    "2021-03-03T16:44:03.509Z angular/cli config Error: \x1B[91merror\x1B[0m\x1B[90m TS5012: \x1B[0mCannot read file 'C:/git_repos/ui/tsconfig.wallaby.spec.json': ENOENT: no such file or directory, open 'C:/git_repos/ui/tsconfig.wallaby.spec.json'.
" +
      '
' +
      '    at Object.readTsconfig (C:\git_repos\ui\node_modules\@angular-devkit\build-angular\src\utils\read-tsconfig.js:28:15)
' +
      '    at generateWebpackConfig (C:\git_repos\ui\node_modules\@angular-devkit\build-angular\src\utils\webpack-browser-config.js:29:38)
' +
      '    at generateBrowserWebpackConfigFromContext (C:\git_repos\ui\node_modules\@angular-devkit\build-angular\src\utils\webpack-browser-config.js:136:26)
',

...

'2021-03-03T16:44:04.532Z workers Failed to map the stack to user code, entry message: window is not defined, stack: ReferenceError: window is not defined
' +
      '    at eval (eval at module.exports (C:\Users\Simon\AppData\Local\JetBrains\IntelliJIdea2020.3\wallaby\wallaby\runners\node\bootstrap.js:14:44), <anonymous>:1:1710)
' +
      '    at eval (eval at module.exports (C:\Users\Simon\AppData\Local\JetBrains\IntelliJIdea2020.3\wallaby\wallaby\runners\node\bootstrap.js:14:44), <anonymous>:1:1747)
' +
      '    at module.exports (C:\Users\Simon\AppData\Local\JetBrains\IntelliJIdea2020.3\wallaby\wallaby\runners\node\bootstrap.js:14:44)
' +
      '    at w.in:run (C:\Users\Simon\AppData\Local\JetBrains\IntelliJIdea2020.3\wallaby\wallaby\server.js:21:5089)
' +
      '    at WebSocket.<anonymous> (C:\Users\Simon\AppData\Local\JetBrains\IntelliJIdea2020.3\wallaby\wallaby\server.js:21:2371)
' +
      '    at WebSocket.emit (events.js:315:20)
' +
      '    at Receiver.ontext (C:\Users\Simon\AppData\Local\JetBrains\IntelliJIdea2020.3\wallaby\wallaby\node_modules\ws\lib\WebSocket.js:841:10)
' +
      '    at C:\Users\Simon\AppData\Local\JetBrains\IntelliJIdea2020.3\wallaby\wallaby\node_modules\ws\lib\Receiver.js:
',
smcenlly commented 3 years ago

If the needed i will provide the full diagnostic report by email.

We'll need some additional information that's provided in the diagnostics report. Could you please email to hello@wallabyjs.com?

NikGovorov commented 3 years ago

Thanks for reporting the issue. It is fixed and the fix is published in the latest core version.