set alias moduleDirectories to require source code easiler

* allow to require module in  packages/react-bootstrap-table2
This commit is contained in:
Chun-MingChen 2017-10-07 22:06:01 +08:00
parent 877259158e
commit d8a6807f1b
20 changed files with 58 additions and 50 deletions

View File

@ -74,6 +74,11 @@
"testEnvironment": "node",
"testMatch": [
"**/test/**/*.test.js"
],
"moduleFileExtensions": ["js", "jsx"],
"moduleDirectories": [
"node_modules",
"packages/react-bootstrap-table2"
]
}
}

View File

@ -2,11 +2,11 @@ import React from 'react';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import Body from '../src/body';
import Row from '../src/row';
import Const from '../src/const';
import RowSection from '../src/row-section';
import mockBodyResolvedProps from '../test/mock-data/body-resolved-props';
import Body from 'src/body';
import Row from 'src/row';
import Const from 'src/const';
import RowSection from 'src/row-section';
import mockBodyResolvedProps from 'test/mock-data/body-resolved-props';
describe('Body', () => {
let wrapper;

View File

@ -2,11 +2,11 @@ import React from 'react';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import Caption from '../src/caption';
import Header from '../src/header';
import Body from '../src/body';
import BootstrapTable from '../src/bootstrap-table';
import Const from '../src/const';
import Caption from 'src/caption';
import BootstrapTable from 'src/bootstrap-table';
import Header from 'src/header';
import Body from 'src/body';
import Const from 'src/const';
describe('BootstrapTable', () => {
let wrapper;

View File

@ -2,8 +2,8 @@ import React from 'react';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import Const from '../src/const';
import Cell from '../src/cell';
import Const from 'src/const';
import Cell from 'src/cell';
describe('Cell', () => {
let wrapper;

View File

@ -3,10 +3,11 @@ import React from 'react';
import sinon from 'sinon';
import { shallow, mount } from 'enzyme';
import { TableRowWrapper } from './test-helpers/table-wrapper';
import EditingCell from '../src/editing-cell';
import TextEditor from '../src/text-editor';
import EditorIndicator from '../src/editor-indicator';
import EditingCell from 'src/editing-cell';
import TextEditor from 'src/text-editor';
import EditorIndicator from 'src/editor-indicator';
import { TableRowWrapper } from 'test/test-helpers/table-wrapper';
describe('EditingCell', () => {
let wrapper;

View File

@ -2,10 +2,10 @@ import React from 'react';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import Const from '../src/const';
import SortCaret from '../src/sort-caret';
import SortSymbol from '../src/sort-symbol';
import HeaderCell from '../src/header-cell';
import Const from 'src/const';
import SortCaret from 'src/sort-caret';
import SortSymbol from 'src/sort-symbol';
import HeaderCell from 'src/header-cell';
describe('HeaderCell', () => {
let wrapper;

View File

@ -1,11 +1,12 @@
import React from 'react';
import { shallow } from 'enzyme';
import HeaderCell from '../src/header-cell';
import SelectionHeaderCell from '../src//row-selection/selection-header-cell';
import Header from '../src/header';
import Const from '../src/const';
import mockHeaderResolvedProps from '../test/mock-data/header-resolved-props';
import HeaderCell from 'src/header-cell';
import SelectionHeaderCell from 'src/row-selection/selection-header-cell';
import Header from 'src/header';
import Const from 'src/const';
import mockHeaderResolvedProps from 'test/mock-data/header-resolved-props';
describe('Header', () => {
let wrapper;

View File

@ -1,4 +1,4 @@
import Const from '../../src/const';
import Const from 'src/const';
const { ROW_SELECT_DISABLED, UNABLE_TO_CELL_EDIT } = Const;

View File

@ -1,4 +1,4 @@
import Const from '../../src/const';
import Const from 'src/const';
const { ROW_SELECT_DISABLED } = Const;

View File

@ -2,9 +2,9 @@ import React, { Component } from 'react';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import { extendTo } from '../test-helpers/mock-component';
import baseResolver from '../../src/props-resolver/index';
import Const from '../../src/const';
import baseResolver from 'src/props-resolver/index';
import Const from 'src/const';
import { extendTo } from 'test/test-helpers/mock-component';
describe('TableResolver', () => {
const keyField = 'id';

View File

@ -1,7 +1,7 @@
import React from 'react';
import { shallow } from 'enzyme';
import RowSection from '../src/row-section';
import RowSection from 'src/row-section';
describe('Row', () => {
const colSpan = 3;

View File

@ -2,7 +2,7 @@ import React from 'react';
import { shallow } from 'enzyme';
import sinon from 'sinon';
import SelectionCell from '../../src/row-selection/selection-cell';
import SelectionCell from 'src/row-selection/selection-cell';
describe('<SelectionCell />', () => {
const mode = 'checkbox';

View File

@ -2,8 +2,8 @@ import React from 'react';
import { shallow } from 'enzyme';
import sinon from 'sinon';
import Constant from '../../src/const';
import SelectionHeaderCell, { CheckBox } from '../../src/row-selection/selection-header-cell';
import Constant from 'src/const';
import SelectionHeaderCell, { CheckBox } from 'src/row-selection/selection-header-cell';
let wrapper;

View File

@ -2,12 +2,13 @@ import React from 'react';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import Cell from '../src/cell';
import Row from '../src/row';
import Const from '../src/const';
import EditingCell from '../src/editing-cell';
import SelectionCell from '../src//row-selection/selection-cell';
import mockBodyResolvedProps from '../test/mock-data/body-resolved-props';
import Cell from 'src/cell';
import Row from 'src/row';
import Const from 'src/const';
import EditingCell from 'src/editing-cell';
import SelectionCell from 'src/row-selection/selection-cell';
import mockBodyResolvedProps from 'test/mock-data/body-resolved-props';
const defaultColumns = [{
dataField: 'id',

View File

@ -1,8 +1,8 @@
import React from 'react';
import { shallow } from 'enzyme';
import Const from '../src/const';
import SortCaret from '../src/sort-caret';
import Const from 'src/const';
import SortCaret from 'src/sort-caret';
describe('SortCaret', () => {
let wrapper;

View File

@ -1,7 +1,7 @@
import React from 'react';
import { shallow } from 'enzyme';
import SortSymbol from '../src/sort-symbol';
import SortSymbol from 'src/sort-symbol';
describe('SortSymbol', () => {
let wrapper;

View File

@ -1,6 +1,6 @@
import Base from '../../src/store/base';
import Const from '../../src/const';
import _ from '../../src/utils';
import Base from 'src/store/base';
import Const from 'src/const';
import _ from 'src/utils';
describe('Store Base', () => {
let store;

View File

@ -1,7 +1,7 @@
import sinon from 'sinon';
import { sort } from '../../src/store/sort';
import Const from '../../src/const';
import { sort } from 'src/store/sort';
import Const from 'src/const';
describe('Sort Function', () => {
const data = [

View File

@ -1,7 +1,7 @@
import React from 'react';
import { shallow } from 'enzyme';
import TextEditor from '../src/text-editor';
import TextEditor from 'src/text-editor';
describe('TextEditor', () => {
let wrapper;

View File

@ -1,4 +1,4 @@
import _ from '../src/utils';
import _ from 'src/utils';
describe('Utils', () => {
describe('get', () => {