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

Build: Add /shared path to unit test runner #1606

Merged
merged 2 commits into from
Dec 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/run-all-tests
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ __cleanup() {
trap __cleanup SIGINT SIGTERM

# Run all tests
find {$BASEDIR/../client,$BASEDIR/../server} -name Makefile | run_test_fast
find {$BASEDIR/../client,$BASEDIR/../server,$BASEDIR/../shared} -name Makefile | run_test_fast
2 changes: 1 addition & 1 deletion shared/components/themes-list/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ COMPILERS ?= jsx:babel/register
NODE_BIN := $(shell npm bin)
MOCHA ?= $(NODE_BIN)/mocha
BASE_DIR := $(NODE_BIN)/../..
NODE_PATH := test:$(BASE_DIR)/client:$(BASE_DIR)/shared
NODE_PATH := test:$(BASE_DIR)/shared

# In order to simply stub modules, add test to the NODE_PATH
test:
Expand Down
14 changes: 8 additions & 6 deletions shared/components/themes-list/test/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ var assert = require( 'chai' ).assert,
mockery = require( 'mockery' ),
sinon = require( 'sinon' );

var MockMoreButton = React.createClass( {
render: function() {
return <div/>;
}
} );
function mockComponent( displayName ) {
return React.createClass( {
displayName,
render: () => { return <div/> }
} );
};

describe( 'ThemesList', function() {
before( function() {
mockery.registerMock( './more-button', MockMoreButton);
mockery.registerMock( './more-button', mockComponent() );
mockery.registerMock( 'components/infinite-list', mockComponent( 'InfiniteList' ) );

mockery.enable( {
warnOnReplace: false,
Expand Down
7 changes: 5 additions & 2 deletions shared/lib/formatting/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
REPORTER ?= spec
MOCHA ?= ../../../node_modules/.bin/mocha
NODE_BIN := $(shell npm bin)
MOCHA ?= $(NODE_BIN)/mocha
BASE_DIR := $(NODE_BIN)/../..
NODE_PATH := test:$(BASE_DIR)/client:$(BASE_DIR)/shared

# In order to simply stub modules, add test to the NODE_PATH
test:
@NODE_ENV=test NODE_PATH=test:../../../client $(MOCHA) --compilers js:babel/register --reporter $(REPORTER)
@NODE_ENV=test NODE_PATH=$(NODE_PATH) $(MOCHA) --compilers js:babel/register --reporter $(REPORTER)

.PHONY: test