Browse Source
chore: Fix react-dnd CI (#17130)
* adjust jest ignore
* add node test
* update es
pull/17132/head
zombieJ
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
7 additions and
4 deletions
-
.jest.js
-
.jest.node.js
-
components/tabs/demo/custom-tab-bar-node.md
|
@ -2,7 +2,7 @@ const libDir = process.env.LIB_DIR; |
|
|
|
|
|
|
|
|
const transformIgnorePatterns = [ |
|
|
const transformIgnorePatterns = [ |
|
|
'/dist/', |
|
|
'/dist/', |
|
|
'node_modules/[^/]+?/(?!(es|node_modules)/)', // Ignore modules without es dir
|
|
|
'node_modules/(?!(_react-dnd|react-dnd|_dnd-core|dnd-core))[^/]+?/(?!(es|node_modules)/)', // Ignore modules without es dir
|
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
module.exports = { |
|
|
module.exports = { |
|
|
|
@ -1,3 +1,5 @@ |
|
|
|
|
|
const { transformIgnorePatterns } = require('./.jest'); |
|
|
|
|
|
|
|
|
// jest config for server render environment
|
|
|
// jest config for server render environment
|
|
|
module.exports = { |
|
|
module.exports = { |
|
|
setupFiles: ['./tests/setup.js'], |
|
|
setupFiles: ['./tests/setup.js'], |
|
@ -10,6 +12,7 @@ module.exports = { |
|
|
}, |
|
|
}, |
|
|
testRegex: 'demo\\.test\\.js$', |
|
|
testRegex: 'demo\\.test\\.js$', |
|
|
testEnvironment: 'node', |
|
|
testEnvironment: 'node', |
|
|
|
|
|
transformIgnorePatterns, |
|
|
snapshotSerializers: ['enzyme-to-json/serializer'], |
|
|
snapshotSerializers: ['enzyme-to-json/serializer'], |
|
|
globals: { |
|
|
globals: { |
|
|
'ts-jest': { |
|
|
'ts-jest': { |
|
|
|
@ -15,7 +15,7 @@ Use `react-dnd` to make tabs draggable. |
|
|
|
|
|
|
|
|
```jsx |
|
|
```jsx |
|
|
import { Tabs } from 'antd'; |
|
|
import { Tabs } from 'antd'; |
|
|
import { DragDropContextProvider, DragSource, DropTarget } from 'react-dnd'; |
|
|
import { DndProvider, DragSource, DropTarget } from 'react-dnd'; |
|
|
import HTML5Backend from 'react-dnd-html5-backend'; |
|
|
import HTML5Backend from 'react-dnd-html5-backend'; |
|
|
|
|
|
|
|
|
const { TabPane } = Tabs; |
|
|
const { TabPane } = Tabs; |
|
@ -127,11 +127,11 @@ class DraggableTabs extends React.Component { |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<DragDropContextProvider backend={HTML5Backend}> |
|
|
<DndProvider backend={HTML5Backend}> |
|
|
<Tabs renderTabBar={this.renderTabBar} {...this.props}> |
|
|
<Tabs renderTabBar={this.renderTabBar} {...this.props}> |
|
|
{orderTabs} |
|
|
{orderTabs} |
|
|
</Tabs> |
|
|
</Tabs> |
|
|
</DragDropContextProvider> |
|
|
</DndProvider> |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|