Skip to content

Commit 0f9718c

Browse files
committed
Restructures project.
2 parents 2444a83 + ef14091 commit 0f9718c

File tree

8 files changed

+21
-32
lines changed

8 files changed

+21
-32
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
> This is my personal starter kit for an npm libraries.
1+
> This is my personal starter kit for npm libraries.
22
33
# Your Library Name
44

test/MyComponent.test.js renamed to src/__tests__/MyComponent.test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
/* @flow */
22

33
import React from 'react';
4-
import MyComponent from '../src/MyComponent';
5-
import describeComponent from './__helpers__/describeComponent';
4+
import MyComponent from '../MyComponent';
5+
import warningsToErrors from '../../tools/tests/warningsToErrors';
6+
7+
describe('MyComponent', () => {
8+
warningsToErrors();
69

7-
describeComponent('MyComponent', () => {
810
it('renders', () => {
911
expect(<MyComponent msg="foo" />).toMatchSnapshot();
1012
});

test/helloWorld.test.js renamed to src/__tests__/helloWorld.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* @flow */
22

3-
// Under test.
4-
import helloWorld from '../src/helloWorld';
3+
import helloWorld from '../helloWorld';
54

65
describe('helloWorld', () => {
76
it('returns the expected result', () => {

test/.eslintrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

test/__helpers__/describeComponent.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

tools/scripts/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const nodeEnv = Object.assign({}, process.env, {
1515
NODE_ENV: 'production',
1616
});
1717

18-
exec('cross-env BABEL_ENV=commonjs babel ./src -d ./commonjs');
18+
exec('cross-env BABEL_ENV=commonjs babel --ignore **/__tests__ ./src -d ./commonjs');
1919
exec('cross-env BABEL_ENV=umd webpack --config ./tools/webpack/umd.config.babel.js', nodeEnv);
2020
exec('cross-env BABEL_ENV=umd webpack --config ./tools/webpack/umd-min.config.babel.js', nodeEnv);
2121

tools/tests/warningsToErrors.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* @flow */
2+
3+
import sinon from 'sinon';
4+
5+
export default function warningsToErrors() {
6+
// Ensure console.warnings become thrown errors.
7+
beforeAll(() => {
8+
sinon.stub(console, 'error', (warning) => { throw new Error(warning); });
9+
});
10+
11+
// While not forgetting to restore it afterwards.
12+
afterAll(() => { console.error.restore(); });
13+
}

0 commit comments

Comments
 (0)