Skip to content

Commit

Permalink
Use CommonJS-style requires for rewire
Browse files Browse the repository at this point in the history
In order for rewire calls to be correctly handled like
require() calls by Webpack, rewire currently needs
to be imported using CommonJS style syntax.

See jhnns/rewire-webpack#12
for a discussion and explanation.
  • Loading branch information
robertknight committed Jan 10, 2016
1 parent d3d6121 commit 1007b11
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"mocha-loader": "^0.7.1",
"null-loader": "^0.1.1",
"react-addons-test-utils": "^0.14.6",
"rewire": "^2.3.1",
"rewire-webpack": "^1.0.0",
"rewire": "^2.5.1",
"rewire-webpack": "^1.0.1",
"rx": "^2.4.3",
"webpack": "^1.7.3",
"webpack-dev-server": "^1.7.0"
Expand Down
8 changes: 7 additions & 1 deletion tests/TweetItem_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ import React from 'react';
import {renderIntoDocument} from 'react-addons-test-utils';

import {expect} from 'chai';
import rewire from 'rewire';

import setup from './setup';

import TweetItem from '../src/TweetItem';

// CommonJS syntax is used for importing rewire for compatibility
// with babel-loader.
//
// See https://github.com/jhnns/rewire-webpack/issues/12#issuecomment-95797024
// for an explanation
var rewire = require('rewire');

const TEST_TWEET = {
id: 'tweet-1',
user: {
Expand Down
3 changes: 2 additions & 1 deletion tests/TweetList_test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, {Component} from 'react';
import {findDOMNode, render} from 'react-dom';
import {createRenderer, scryRenderedComponentsWithType, renderIntoDocument} from 'react-addons-test-utils';
import rewire from 'rewire';
import {expect} from 'chai';

import * as utils from './utils';

import TweetItem from '../src/TweetItem';

var rewire = require('rewire');

const TEST_TWEETS = [{
id: 'tweet-1',
user: {
Expand Down

0 comments on commit 1007b11

Please sign in to comment.