karma-runner / karma-runner/karma
Cannot read property * of null when using grunt watch
- Dominant language
- JavaScript
- Stars
- 12k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
### Expected behavior
Tests should rerun successfully
### Actual behavior
Error thrown to console:
```
Missing error handler on `socket`.
Done.
TypeError: Cannot read property '27391504' of null
at [object Object].onBrowserComplete (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/karma-htmlfile-reporter/index.js:97:23)
at [object Object]. (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/karma/lib/events.js:13:22)
at emitTwo (events.js:105:20)
at [object Object].emit (events.js:185:7)
at [object Object].onComplete (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/karma/lib/browser.js:143:13)
at Socket. (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/karma/lib/events.js:13:22)
at emitTwo (events.js:105:20)
at Socket.emit (events.js:185:7)
at Socket.onevent (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/socket.io/lib/socket.js:335:8)
at Socket.onpacket (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/socket.io/lib/socket.js:295:12)
at Client.ondecoded (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/socket.io/lib/client.js:193:14)
at Decoder.Emitter.emit (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/component-emitter/index.js:134:20)
at Decoder.add (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/socket.io-parser/index.js:247:12)
at Client.ondata (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/socket.io/lib/client.js:175:18)
at emitOne (events.js:90:13)
at Socket.emit (events.js:182:7)
at Socket.onPacket (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/engine.io/lib/socket.js:101:14)
at emitOne (events.js:90:13)
at WebSocket.emit (events.js:182:7)
at WebSocket.Transport.onPacket (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/engine.io/lib/transport.js:104:8)
at WebSocket.Transport.onData (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/engine.io/lib/transport.js:115:8)
at WebSocket.onData (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/engine.io/lib/transports/websocket.js:76:30)
at emitTwo (events.js:100:13)
at WebSocket.emit (events.js:185:7)
at Receiver.ontext (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/ws/lib/WebSocket.js:816:10)
at /Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/ws/lib/Receiver.js:477:18
at Receiver.applyExtensions (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/ws/lib/Receiver.js:364:5)
at /Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/ws/lib/Receiver.js:466:14
at Receiver.flush (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/ws/lib/Receiver.js:340:3)
at Receiver.opcodes.1.finish (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/ws/lib/Receiver.js:482:12)
at Receiver.expectHandler (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/ws/lib/Receiver.js:451:33)
at Receiver.add (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/ws/lib/Receiver.js:95:24)
at Socket.realHandler (/Users/mckeowr/Documents/git/streamline-dh/vsldh-ui/node_modules/ws/lib/WebSocket.js:800:20)
at emitOne (events.js:90:13)
at Socket.emit (events.js:182:7)
at readableAddChunk (_stream_readable.js:153:18)
at Socket.Readable.push (_stream_readable.js:111:10)
at TCP.onread (net.js:529:20)
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
```
### Enviroment Details
- Karma version (output of `karma --version`): 1.1.0 (this issue doesn't happen with 1.0.0)
- Relevant part of your `karma.config.js` file:
```
frameworks: ['jasmine'],
plugins: ['karma-jasmine', 'karma-firefox-launcher', 'karma-chrome-launcher', 'karma-phantomjs-launcher', 'karma-coffee-preprocessor', 'karma-ng-html2js-preprocessor', 'karma-htmlfile-reporter', 'karma-coverage'],
preprocessors: {
'src/app/**/*.tpl.html': 'ng-html2js',
'src/**/!(*\.spec).js': 'coverage'
},
reporters: ['html', 'coverage', 'progress'],
htmlReporter: {
outputFile: 'build/tests/test-results.html'
},
coverageReporter: {
type: 'html',
dir: 'build/coverage/'
},
browsers: ['PhantomJS']
```
- plugins from package.json:
```
"grunt":"1.0.1",
"grunt-bump": "0.8.0",
"grunt-contrib-clean": "1.0.0",
"grunt-contrib-concat": "1.0.1",
"grunt-contrib-copy": "1.0.0",
"grunt-contrib-jshint": "1.0.0",
"grunt-contrib-less": "1.3.0",
"grunt-contrib-uglify": "1.0.1",
"grunt-contrib-watch": "1.0.0",
"grunt-conventional-changelog": "6.1.0",
"grunt-express": "1.4.1",
"grunt-html2js": "0.3.6",
"grunt-karma": "2.0.0",
"grunt-ngmin": "0.0.3",
"grunt-open": "0.2.3",
"grunt-parallel": "^0.5.1",
"grunt-recess": "1.0.1",
"grunt-karma": "2.0.0",
"jasmine-core": "2.4.1",
"karma": "1.1.0",
"karma-chrome-launcher": "0.2.2",
"karma-coffee-preprocessor": "*",
"karma-coverage": "0.5.5",
"karma-firefox-launcher": "0.1.7",
"karma-html2js-preprocessor": "0.1.0",
"karma-htmlfile-reporter": "0.2.2",
"karma-jasmine": "0.3.7",
"karma-ng-html2js-preprocessor": "0.2.1",
"karma-phantomjs-launcher": "^1.0.0",
"karma-requirejs": "0.2.5",
"karma-script-launcher": "0.2.0",
"phantomjs-prebuilt": "2.1.7"
```
### Steps to reproduce the behaviour
1.run grunt watch - tests run successfully
2. change a test file
3. it attempts to rerun but throws error (shown above)
Keeping all the dependencies and configuration the same and just downgrading karma to 1.0.0 prevents the issue.
Contributor guide
Research direction
Start by reproducing the failure with `grunt watch` using Karma 1.1.0 and the provided configuration, then inspect `node_modules/karma-htmlfile-reporter/index.js` at the reported `onBrowserComplete` line and compare behavior with Karma 1.0.0. Done means changing a test no longer produces the null-property error and the tests rerun successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100