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

Test: Remove legacy test runner #4596

Merged
merged 12 commits into from
Apr 21, 2016
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
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', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expected value is usually first.

Copy link
Member Author

@gziolo gziolo Apr 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, lenghtOf is tricky:

.lengthOf(object, length, [message])

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I get it now – the grammar would be wrong if the length was the first argument.

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.

11 changes: 6 additions & 5 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,22 +28,23 @@ 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;

siteListMock = { getSelectedSite: () => sites[ 0 ] };
PluginsList = require( '../' );
} );

describe.only( 'rendering bulk actions', function() {
describe( 'rendering bulk actions', function() {
let renderedPluginsList, plugins, props;

before( () => {
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