Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I debug this? #132

Closed
cellog opened this issue Jun 25, 2016 · 7 comments
Closed

How can I debug this? #132

cellog opened this issue Jun 25, 2016 · 7 comments

Comments

@cellog
Copy link

cellog commented Jun 25, 2016

I am running this test:

import 'should'
import $ from 'teaspoon'
import React, { Component, PropTypes } from 'react'

import Selection from '../src/Selection.jsx'

describe("Selection", () => {
  it("should work", () => {
    expect(true).to.be.true
    expect($).to.equal($)
    expect(React).to.equal(React)
    expect(Component).to.equal(Component)
    expect(PropTypes).to.equal(PropTypes)
  })
})

in a checkout of https://github/cellog/react-selection/tests

with these karma configs (first is karma.common.conf.js):

/* eslint no-var: 0, babel/object-shorthand: 0, vars-on-top: 0 */
require('babel-register')

var isCI = process.env.CONTINUOUS_INTEGRATION === 'true'
var reporters = ['mocha', 'saucelabs', 'coverage']
var singleRun = true

var sauceParams = {
  testName: "react-selection-hoc unit tests",
  username: process.env.SAUCEUSER,
  accessKey: process.env.ACCESSSAUCE,
  connectOptions: {
    logfile: 'sauce_connect.log'
  }
}

var coverageReporter = isCI ? {
  reporters: [
    {
      type: 'lcov',
      dir: 'coverage'
    },
    {
      type: 'text'
    }
  ]
} : {
  reporters: [
    {
      type: 'lcov',
      dir: 'coverage'
    },
    {
      type: 'text'
    }
  ]
}
const frameworks = ['mocha', 'sinon-chai']
if (isCI) {
  sauceParams.build = process.env.TRAVIS_BUILD_NUMBER
} else {
  sauceParams.build = `Local Testing ${process.env.CURRENTTIME}`
  sauceParams.startConnect = false
}

module.exports = function(config, extraoptions) {
  config.set({

    basePath: '',

    frameworks,

    files: [
      'test/boo.test.js'
    ],

    preprocessors: {
      'test/boo.test.js': ['webpack'],
    },

    webpack: require('./test/test.config.es6.js'),

    webpackMiddleware: {
      noInfo: true
    },

    reporters: reporters,

    mochaReporter: {
      output: 'autowatch'
    },

    port: 9876,

    colors: true,

    logLevel: config.LOG_INFO,

    autoWatch: true,

    sauceLabs: sauceParams,

    coverageReporter,

    captureTimeout: 2400000,
    browserNoActivityTimeout: 240000,

    singleRun,

    ...extraoptions
  })
}

here is the webpack config (tests/test.config.es6.js):

const stuff = {

  output: {
    pathinfo: true
  },

  module: {
    preLoaders: [
      { test: /\.js$/, loader: 'isparta', include: /src/, exclude: 'index.js' },
      { test: /\.jsx$/, loader: 'isparta', include: /src/}
    ],
    loaders: [
      { test: /\.js/, loader: 'babel-loader', exclude: /node_modules/ },
    ]
  },

  devtool: 'inline-source-map'
}

export default stuff

and this one as the primary (karma.ie.conf.js):

/* eslint no-var: 0, babel/object-shorthand: 0, vars-on-top: 0 */
require('babel-register')
var karma = require('./karma-common.conf.js')
var browsers = require('./test/onlyie.js')

module.exports = function(config) {
  return karma(config, {
    customLaunchers: browsers,
    browsers: Object.keys(browsers)
  })
}

onlyie.js is:

const browsers = {
  sl_edge_10_13: {
    base: 'SauceLabs',
    browserName: 'MicrosoftEdge',
    platform: 'Windows 10',
    version: '13.10586'
  },
  sl_ie_10_11: {
    base: 'SauceLabs',
    browserName: 'internet explorer',
    platform: 'Windows 10',
    version: '11.103'
  },
  sl_ie_8_10: {
    base: 'SauceLabs',
    browserName: 'internet explorer',
    platform: 'Windows 8',
    version: '10'
  }
}
export default browsers

and using this script to run the tests after starting sc 4.3.16:

#!/usr/bin/env bash
npm run lint
export SAUCEUSER="[replaced with my sauce user]"
export ACCESSSAUCE="[replaced with my sauce access key]"
export CURRENTTIME=$(date +%Y%m%d-%H%M%S)
#./node_modules/karma/bin/karma start karma.quicktest.conf.js
#./node_modules/karma/bin/karma start karma.ios.conf.js
#./node_modules/karma/bin/karma start karma.noie.conf.js
./node_modules/karma/bin/karma start karma.ie.conf.js
./node_modules/.bin/lcov-result-merger 'coverage/*/lcov.info' 'coverage/lcov.info'

Now here's the kicker: If I remove the "import Selection from '../src/Selection.jsx'" line, the test works. If I leave it in, Edge 13 on Windows 10 hangs indefinitely. I don't see any errors when I take control and check developer tools, but it doesn't send anything back. How the hell can I debug this problem? The test works just fine with a local karma on Chrome and Safari.

What I'm running into is that every test hangs indefinitely in every browser when running them through TravisCI, and this is the smallest test I can make to reproduce the issue. Note that I'm not even using the Selection code, just including it into the file.

@joshwiens
Copy link
Contributor

@cellog given this import Selection from '../src/Selection.jsx' I'm wondering if at runtime for travis/suacelabs that relative path isn't what you would think it is.

@joshwiens
Copy link
Contributor

As a test, i'd grab Selection.jsx and temporarily stick it in the same directory as the test you are executing i.e. import Selection from './Selection.jsx'

This would at least rule out the path problem possibility

@joshwiens
Copy link
Contributor

Outside of that, i'll have to dig into the example code / repo you linked and see if I can figure out why it's tanking on a remote run but to me this screams relative path / execution context issue ( had more than a few of these recently )

@cellog
Copy link
Author

cellog commented Jul 26, 2016

The tests work if I run a single browser, without code coverage, so it
isn't in the code. Also, the tests work on browserstack in every browser,
which is what I am using now until (if) SauceLabs gets its act together.

via CloudMagic Email
[https://cloudmagic.com/k/d/mailapp?ct=pa&cv=8.5.49&pv=5.1.1&source=email_footer_2]

@joshwiens
Copy link
Contributor

My point wasn't so much a code problem and more related to the context in which SauceLabs is running things in. I've had my own issues related to SauceLabs and execution context as well as the inability to reliably debug tasks which are fired off in isolation.

@cellog
Copy link
Author

cellog commented Jul 30, 2016

I see. thanks. Since I'm using browserstack, I suppose you could close this, and if you want to investigate saucelabs, open a new issue?

@joshwiens
Copy link
Contributor

Will do though my work around was the same as yours. I just simply went over to Browserstack and avoided all the goofy contextual issues in Sauce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants