Skip to content

Commit

Permalink
throw helpful error to diagnose broken builds
Browse files Browse the repository at this point in the history
  • Loading branch information
wheresrhys committed Nov 8, 2015
1 parent 635cc76 commit 28bb937
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Mock http requests made using fetch (or [isomorphic-fetch](https://www.npmjs.com
- Browser tests: `require('fetch-mock)`
- Server side tests running in nodejs 4 or higher: `require('fetch-mock/server')`
- Server side tests running in nodejs 0.12 or lower: `require('fetch-mock/es5/server)`

You will need to ensure `fetch` and `Promise` are already available as globals in your environment


Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = function(karma) {
'test/client.js': ['browserify']
},
browserify: {
transform: ['babelify'],
transform: [['babelify', { presets: ['es2015'] }]],
debug: true
},
browsers: ['Chrome'],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"babel": "^6.0.15",
"babel-cli": "^6.1.2",
"babel-preset-es2015": "^6.1.2",
"babelify": "^7.0.0",
"babelify": "^7.2.0",
"browserify": "^12.0.0",
"chai": "^2.3.0",
"karma": "^0.12.31",
Expand Down
4 changes: 4 additions & 0 deletions src/client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
'use strict';

if (!window) {
throw 'Incorrect fetch-mock: require(\'fetch-mock/server\') in nodejs >= 4, or require(\'fetch-mock/es5/server\' in nodejs 0.12.x';
}

const FetchMock = require('./fetch-mock');

module.exports = new FetchMock({
Expand Down

0 comments on commit 28bb937

Please sign in to comment.