wallabyjs / public

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

Wallaby hangs sometimes during startup in Visual Studio #907

Closed maccurt closed 5 years ago

maccurt commented 7 years ago

Sometimes when I run wallabyJs it works right away, very fast.. other time when I start it, it just hangs and the little indicator in the right hand corner just spins. If I restart it ,it will then sometimes work right away, other times I have to toggle the debug config. Any ideas on what I could be doing wrong?

Code editor or IDE name and version

Visual Studio 2015

OS name and version

Windows

ArtemGovorov commented 7 years ago

Could you please share your wallaby config?

How frequently does it happen for you? Like every other start/restart, once every 10..100 (re)starts?

Also, could you please set debug: true in your wallaby config, and next time it hangs, copy the output from the Wallaby.js Console output channel.

aidanmischke commented 7 years ago

Hi Artem,

I'm getting similar hanging symptoms frequently in my work project.

Scenarios

Run: works. Rerun: hangs. Stop. Run: hangs.

Run: works. Stop. Run: hangs.

It always hangs on the same line. browserRunner Sandbox is generated [worker #0, session #stw3a]: http://localhost:53264/wallaby_sandbox0.html

After the first hang it consistently hangs on subsequent runs. Making any change to wallaby.js such as adding whitespace resets the hang streak; fixes it temporarily.

I was unable to create a reproducible example of this from the ngCliWebpackSample.

Code editor or IDE name and version

WebStorm 2016.3.3 Build #WS-163.12024.17, built on January 31, 2017

OS name and version

Windows 10 Pro Version 1607 (OS Build 14393.693)

Wallaby Console log

wallaby.js started
_...skipping line about processing of our project's files..._
Thu, 16 Feb 2017 07:00:41 GMT wallaby:postprocessor New compiler created
Thu, 16 Feb 2017 07:00:42 GMT wallaby:postprocessor Webpack compilation started
Thu, 16 Feb 2017 07:00:45 GMT wallaby:postprocessor Webpack compilation finished
Thu, 16 Feb 2017 07:00:46 GMT wallaby:postprocessor Emitting 566 files
Thu, 16 Feb 2017 07:00:48 GMT wallaby:project Postprocessor execution finished
Thu, 16 Feb 2017 07:00:48 GMT wallaby:project Test run started; run priority: 3
Thu, 16 Feb 2017 07:00:48 GMT wallaby:project Running all tests
Thu, 16 Feb 2017 07:00:48 GMT wallaby:workers Starting test run, priority: 3
Thu, 16 Feb 2017 07:00:48 GMT wallaby:phantomRunner Starting sandbox [worker #0, session #stw3a]
Thu, 16 Feb 2017 07:00:48 GMT wallaby:phantomRunner Preparing sandbox [worker #0, session #stw3a]
Thu, 16 Feb 2017 07:00:48 GMT wallaby:browserRunner Total files to load in sandbox: 566
Thu, 16 Feb 2017 07:00:48 GMT wallaby:browserRunner Sandbox is generated [worker #0, session #stw3a]: http://localhost:53264/wallaby_sandbox0.html

wallaby.js


var wallabyWebpack = require('wallaby-webpack');

var webpackPostprocessor = wallabyWebpack({
    entryPatterns: [
        'app/wallabyTest.js',
        'app/**/*spec.js'
    ],

    module: {
        loaders: [
            {test: /\.css$/, loader: 'raw-loader'},
            {test: /\.html$/, loader: 'raw-loader'},
            {test: /\.js$/, loader: 'angular2-template-loader', exclude: /node_modules/},
            {test: /\.json$/, loader: 'json-loader'},
            {test: /\.styl$/, loaders: ['raw-loader', 'stylus-loader']},
            {test: /\.less$/, loaders: ['raw-loader', 'less-loader']},
            {test: /\.scss$|\.sass$/, loaders: ['raw-loader', 'sass-loader']},
            {test: /\.(jpg|png)$/, loader: 'url-loader?limit=128000'}
         ]
     }
});

var compilerOptions = require('./tsconfig.json').compilerOptions;

module.exports = function (wallaby) {

    return {
        files: [
            {pattern: 'app/**/*.ts', load: false},
            {pattern: 'app/**/*.d.ts', ignore: true},
            {pattern: 'app/**/*.css', load: false},
            {pattern: 'app/**/*.json', load: false},
            {pattern: 'app/**/*.less', load: false},
            {pattern: 'app/**/*.scss', load: false},
            {pattern: 'app/**/*.sass', load: false},
            {pattern: 'app/**/*.html', load: false},
            {pattern: 'app/**/*spec.ts', ignore: true}
        ],

        tests: [
            {pattern: 'app/**/*spec.ts', load: false}
        ],

        testFramework: 'jasmine',

        compilers: {
            '**/*.ts': wallaby.compilers.typeScript(compilerOptions)
        },

        postprocessor: webpackPostprocessor,

        setup: function () {
            window.__moduleBundler.loadTests();
        },

        debug: true
    };
};

npm packages (package.json)

"@angular-redux/store": "6.0.0",
    "@angular/common": "4.0.0-beta.5",
    "@angular/compiler": "4.0.0-beta.5",
    "@angular/compiler-cli": "4.0.0-beta.5",
    "@angular/core": "4.0.0-beta.5",
    "@angular/forms": "4.0.0-beta.5",
    "@angular/http": "4.0.0-beta.5",
    "@angular/platform-browser": "4.0.0-beta.5",
    "@angular/platform-browser-dynamic": "4.0.0-beta.5",
    "@angular/platform-server": "4.0.0-beta.5",
    "@angular/router": "4.0.0-beta.5",
    "@angular/upgrade": "4.0.0-beta.5",
    "@ngrx/core": "1.2.0",
    "@ngtools/webpack": "1.1.9",
    "@types/core-js": "0.9.35",
    "@types/jasmine": "2.5.42",
    "@types/jasminewd2": "^2.0.1",
    "@types/lodash": "4.14.52",
    "@types/node": "7.0.4",
    "@types/selenium-webdriver": "2.53.39",
    "ag-grid": "7.2.2",
    "ag-grid-ng2": "7.2.2",
    "angular2-jwt": "0.1.28",
    "angular2-load-children-loader": "0.1.3",
    "angular2-modal": "2.0.3",
    "angular2-template-loader": "0.6.2",
    "angular2-toaster": "2.0.0",
    "auth0-lock": "10.10.2",
    "autoprefixer": "6.7.2",
    "awesome-typescript-loader": "3.0.3",
    "bootstrap": "3.3.7",
    "browser-sync": "2.18.7",
    "codelyzer": "0.0.28",
    "copy-webpack-plugin": "4.0.1",
    "core-js": "2.4.1",
    "cssnano": "3.10.0",
    "debug-loader": "0.0.1",
    "del": "2.2.2",
    "electron": "1.4.15",
    "es6-promise": "4.0.5",
    "es6-promise-loader": "1.0.2",
    "es6-shim": "0.35.3",
    "extract-text-webpack-plugin": "2.0.0-beta.4",
    "gulp": "3.9.1",
    "gulp-less": "3.3.0",
    "gulp-livereload": "3.8.1",
    "gulp-postcss": "6.3.0",
    "gulp-rename": "1.2.2",
    "gulp-sequence": "0.4.6",
    "gulp-sourcemaps": "2.4.0",
    "gulp-tsc": "1.2.6",
    "gulp-typescript": "3.1.4",
    "gulp-uglify": "2.0.1",
    "gulp.spritesmith": "6.3.0",
    "gutil": "1.6.4",
    "html-webpack-plugin": "2.28.0",
    "immutable": "3.8.1",
    "jasmine": "2.5.3",
    "jasmine-core": "2.5.2",
    "jquery": "3.1.1",
    "json-loader": "0.5.4",
    "karma": "1.4.1",
    "karma-chrome-launcher": "2.0.0",
    "karma-electron": "5.1.1",
    "karma-jasmine": "1.1.0",
    "karma-mocha-reporter": "^2.2.2",
    "karma-phantomjs-launcher": "1.0.2",
    "karma-sourcemap-loader": "0.3.7",
    "karma-teamcity-reporter": "2.0.0",
    "karma-webpack": "2.0.2",
    "less-plugin-rewrite-import": "0.1.1",
    "lodash": "4.17.4",
    "merge-stream": "1.0.1",
    "ms-signalr-client": "2.2.5",
    "ng2-handsontable": "0.37.1",
    "ng2-toastr": "1.4.1",
    "ng2-translate": "5.0.0",
    "ngtools-webpack-keep-decorators": "1.1.7",
    "node-sass": "4.4.0",
    "open": "0.0.5",
    "os": "0.1.1",
    "performance-now": "2.0.0",
    "phantomjs2": "2.2.0",
    "postcss-simple-vars": "3.0.0",
    "precss": "1.4.0",
    "primeng": "1.1.4",
    "protractor": "5.1.1",
    "raw-loader": "0.5.1",
    "redux": "3.6.0",
    "redux-localstorage": "0.4.1",
    "reflect-metadata": "0.1.9",
    "run-sequence": "1.2.2",
    "rxjs": "5.1.0",
    "sass-loader": "4.1.1",
    "semantic-ui-less": "2.2.4",
    "sinon": "2.0.0-pre.2",
    "source-map-loader": "0.1.6",
    "stats-webpack-plugin": "0.4.3",
    "stylelint-webpack-plugin": "0.5.1",
    "systemjs": "0.20.4",
    "ts-helpers": "1.1.2",
    "ts-loader": "2.0.0",
    "ts-node": "2.1.0",
    "tslint": "4.4.2",
    "typescript": "2.2.0",
    "typings": "2.1.0",
    "wallaby-webpack": "0.0.33",
    "webpack": "2.2.1",
    "webpack-split-by-path": "2.0.0",
    "webpack-stream": "3.2.0",
    "zone.js": "0.7.6"
ArtemGovorov commented 7 years ago

@aidanmischke Could you please

aidanmischke commented 7 years ago

The Fix

  • try switching to Chrome/Electron runner from the default PhantomJs (that seems to be causing the issue) to see if it changes anything.

Switched to Electron and the hanging issue appears to be resolved.

Extra Info

  • stop wallaby and have a look into the process explorer to see if there're any hanging PhantomJs processes,

PhantomJs processes close on stopping of wallaby.

  • tell how many cores/processors your machine has,

CPU has 2 physical cores and 4 logical processors.

  • after it hangs, please search for Started run worker instance, Starting run worker instance, Failed to create worker instance and let me know the results,

Searched the Wallaby Console for keywords and only matched on Starting run worker instance

Thu, 16 Feb 2017 22:52:35 GMT wallaby:workers Starting run worker instance #0
Thu, 16 Feb 2017 22:52:35 GMT wallaby:workers Starting run worker instance #1
Thu, 16 Feb 2017 22:52:35 GMT wallaby:workers Web server is listening at 64322
Thu, 16 Feb 2017 22:52:36 GMT wallaby:project Stopping process pool
Thu, 16 Feb 2017 22:52:36 GMT wallaby:project File cache is up-to-date, starting full test run
Thu, 16 Feb 2017 22:52:36 GMT wallaby:project Running postprocessor
Thu, 16 Feb 2017 22:52:36 GMT wallaby:postprocessor New TypeScript language service is required
...
ralzinov commented 7 years ago

Got the same issue with Webstorm. Wallaby stuck with lines as mentioned above. Found few ways to temporary fix issue:

  1. Edit config file, or
  2. Delete wallaby cache folder, or
  3. Kill PhantomJS processes if them hangs, or
  4. KIll all node processes

PhantomJS hangs sometimes (rarely). 4 cores, 4 threads. When switched to electron env, problem disappeared, but our tests is for browser not for electron, and some tests fails, so i don't think electron is good choice for us.

ArtemGovorov commented 7 years ago

@ralzinov Thanks for the notes, we'll take a look.

When switched to electron env, problem disappeared, but our tests is for browser not for electron, and some tests fails, so i don't think electron is good choice for us.

Wallaby is not using anything from electron except from its "Chrome part", so running tests in Electron runner is like running them in the latest versions of Chrome. If some of your tests fail there - they may be failing in Chrome, so it may be worth looking into why they're failing anyway.

ralzinov commented 7 years ago

@ArtemGovorov Thank you, fixed our tests. Electron seems to be solution. Do you have a plans for a headless chrome support?

ArtemGovorov commented 7 years ago

@ralzinov Great, thanks for the update. Yes, we are considering adding headless Chrome support.

samal-rasmussen commented 7 years ago

I had this problem on a Windows 10 machine using VS Code 1.13.1. I couldn't find any node or phantomjs processes, but rebooting the computer fixed it ¯\(ツ)

samal-rasmussen commented 7 years ago

Issue came back today. Seems that it happened both times over nigh after the computer went to sleep and was woken again. Still didn't see any hanging node or phantomjs instances. This time I tried changing to electron, and that worked right away.