Skip to content

Commit

Permalink
Merge pull request #4596 from Automattic/try/remove-legacy-test-runner
Browse files Browse the repository at this point in the history
Test: Remove legacy test runner
  • Loading branch information
nb committed Apr 21, 2016
2 parents 39ad6c3 + 507db47 commit 7e7c801
Show file tree
Hide file tree
Showing 18 changed files with 77 additions and 909 deletions.
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,8 @@ node_modules: package.json | node-version
@$(NPM) install
@touch node_modules

# run `make test` in all discovered Makefiles
test: build
@npm run test-client
@npm run test-server
@npm run test-test
@$(BIN)/run-all-tests
@$(NPM) test

lint: node_modules/eslint node_modules/eslint-plugin-react node_modules/babel-eslint mixedindentlint
@$(NPM) run lint
Expand Down
87 changes: 0 additions & 87 deletions bin/run-all-tests

This file was deleted.

13 changes: 0 additions & 13 deletions bin/run-tests

This file was deleted.

20 changes: 3 additions & 17 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,12 @@ test:
- client/**/*.jsx
- server/**/*.js
- server/**/*.jsx
- NODE_ENV=test ./bin/run-tests:
- MOCHA_FILE=./test-results-client.xml npm run test-client -- -R mocha-junit-reporter -t $CIRCLE_NODE_TOTAL -i $CIRCLE_NODE_INDEX:
parallel: true
files:
- client/**/Makefile
- server/**/Makefile
- MOCHA_FILE=./test-results-client.xml npm run test-client -- --reporter=mocha-junit-reporter:
- MOCHA_FILE=./test-results-server.xml npm run test-server -- -R mocha-junit-reporter -t $CIRCLE_NODE_TOTAL -i $CIRCLE_NODE_INDEX:
parallel: true
files:
- client/**/test/*.js
- client/**/test/*.jsx
- MOCHA_FILE=./test-results-server.xml npm run test-server -- --reporter=mocha-junit-reporter:
- MOCHA_FILE=./test-results-test.xml npm run test-test -- -R mocha-junit-reporter -t $CIRCLE_NODE_TOTAL -i $CIRCLE_NODE_INDEX:
parallel: true
files:
- server/**/test/*.js
- server/**/test/*.jsx
- MOCHA_FILE=./test-results-test.xml npm run test-test -- --reporter=mocha-junit-reporter:
parallel: true
files:
- test/test/**/test/*.js
- test/test/**/test/*.jsx
post:
- mkdir -p $CIRCLE_TEST_REPORTS/junit/ && find . -type f -regex "./test-results.*\.xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;:
parallel: true
10 changes: 0 additions & 10 deletions client/components/button-group/makefile

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

require( 'lib/react-test-env-setup' )();

/**
* External dependencies
*/
Expand All @@ -11,18 +8,19 @@ import sinon from 'sinon';

describe( 'ButtonGroup', function() {
let sandbox, ButtonGroup, Button;

beforeEach( function() {
sandbox = sinon.sandbox.create();
sandbox.stub( console, 'error');
sandbox.stub( console, 'log');
sandbox.stub( console, 'error' );
sandbox.stub( console, 'log' );

ButtonGroup = require( '../index' );
Button = require( 'components/button' );
} );

afterEach( function() {
sandbox.restore();
})
} );

it( 'should have ButtonGroup class', function() {
const buttonGroup = shallow( <ButtonGroup /> );
Expand All @@ -35,9 +33,8 @@ describe( 'ButtonGroup', function() {
} );

it( 'should throw an error if any of the children is not a <Button>', function() {
const buttonGroup = (
<ButtonGroup><div id="test">test</div></ButtonGroup>
);
shallow( <ButtonGroup><div id="test">test</div></ButtonGroup> );

sinon.assert.calledWithExactly( console.error, 'Warning: Failed propType: All children elements should be a Button.' );
} );
} );
10 changes: 0 additions & 10 deletions client/components/feature-example/makefile

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

require( 'lib/react-test-env-setup' )();

/**
* External dependencies
*/
Expand All @@ -14,13 +11,13 @@ import { shallow } from 'enzyme';
import FeatureExample from '../index';

describe( 'Feature Example', function() {
it( 'should have Feature-example class', function() {
it( 'should have Feature-example class', () => {
const featureExample = shallow( <FeatureExample /> );
assert.equal( 1, featureExample.find( '.feature-example' ).length );
assert.lengthOf( featureExample.find( '.feature-example' ), 1 );
} );

it( 'should contains the passed children wrapped by a feature-example div', function() {
it( 'should contains the passed children wrapped by a feature-example div', () => {
const featureExample = shallow( <FeatureExample><div>test</div></FeatureExample> );
assert.equal( true, featureExample.contains( '<div>test</div>' ) );
assert.isTrue( featureExample.contains( <div>test</div> ) );
} );
} );
14 changes: 0 additions & 14 deletions client/lib/auth-code-request-store/Makefile

This file was deleted.

9 changes: 5 additions & 4 deletions client/my-sites/plugins/plugins-list/test/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { expect } from 'chai';
*/
import useMockery from 'test/helpers/use-mockery';
import useFakeDom from 'test/helpers/use-fake-dom';
import useI18n from 'test/helpers/use-i18n';

import { sites } from './fixtures';
import i18n from 'lib/mixins/i18n';

describe( 'PluginsList', () => {
let React, testRenderer, PluginsList, siteListMock;
Expand All @@ -28,14 +28,15 @@ describe( 'PluginsList', () => {
mockery.registerMock( 'lib/sites-list', () => siteListMock );
} );

useI18n();

before( () => {
React = require( 'react' );

const TestUtils = require( 'react-addons-test-utils' ),
ReactInjection = require( 'react/lib/ReactInjection' );

i18n.initialize();
ReactInjection.Class.injectMixin( i18n.mixin );
ReactInjection.Class.injectMixin( require( 'lib/mixins/i18n' ).mixin );

testRenderer = TestUtils.renderIntoDocument;

Expand All @@ -58,7 +59,7 @@ describe( 'PluginsList', () => {
selectedSite: sites[ 0 ],
isPlaceholder: false,
pluginUpdateCount: plugins.length
}
};
} );

beforeEach( () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
/**
* External dependencies
*/
import assert from 'assert';
import sinon from 'sinon';

describe( 'domain-management/edit/mapped-domain', () => {
/**
* Internal dependencies
*/
import useFakeDom from 'test/helpers/use-fake-dom';
import useI18n from 'test/helpers/use-i18n';
import useMockery from 'test/helpers/use-mockery';

describe( 'mapped-domain', () => {
let React,
MappedDomain,
i18n,
props,
TestUtils;

Expand All @@ -22,14 +31,16 @@ describe( 'domain-management/edit/mapped-domain', () => {
};
} );

require( 'test/helpers/use-fake-dom' ).withContainer();
useFakeDom.withContainer();
useMockery();
useI18n();

require( 'test/helpers/use-mockery' )( mockery => {
before( () => {
React = require( 'react' );
TestUtils = require( 'react-addons-test-utils' );
i18n = require( 'test/helpers/mocks/i18n' )( mockery );

const ReactInjection = require( 'react/lib/ReactInjection' );
ReactInjection.Class.injectMixin( i18n );
ReactInjection.Class.injectMixin( require( 'lib/mixins/i18n' ).mixin );
MappedDomain = require( '../mapped-domain.jsx' );
} );

Expand Down
Loading

0 comments on commit 7e7c801

Please sign in to comment.