-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(test): jest support runtime plugin init (#9131)
* chore(examples-test): π§ enable request plugin * test(example-test): β add requets test case * chore: π§ update jest config * refactor: π¨ add umi runtime plugin init in jest setup * feat: β¨ add test-setup for umi * feat(umi-preset): β¨ generate setup using internal test-setup * test(example-test): β using internal test-setup.js * chore: β¬οΈ update npnm-lock * fix(perset-umi): π @@ tsc error * chore: π₯ remove blank lines * chore: β¬οΈ update npnm-lock Co-authored-by: pshu <pishu.spf@antfin.com>
- Loading branch information
1 parent
1debeca
commit b912bbe
Showing
10 changed files
with
1,218 additions
and
1,267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
export default { | ||
npmClient: 'pnpm', | ||
plugins: ['@umijs/plugins/dist/dva'], | ||
plugins: ['@umijs/plugins/dist/dva', '@umijs/plugins/dist/request'], | ||
dva: { | ||
immer: { | ||
enableES5: true, | ||
enableAllPlugins: true, | ||
}, | ||
}, | ||
request: {}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
// @ts-ignore | ||
import { connect } from 'dva'; | ||
import { useAppData } from 'umi'; | ||
|
||
import { useAppData, request } from 'umi'; | ||
test('import from umi works', () => { | ||
expect(useAppData).toBeDefined(); | ||
expect(connect).toBeDefined(); | ||
}); | ||
|
||
test('import request from umi works', () => { | ||
expect(request).toBeTruthy(); | ||
request(`https://registry.npmjs.com/umi/2.0.0`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
import '@testing-library/jest-dom'; | ||
import 'umi/test-setup'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require('umi/test-setup'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// @ts-ignore | ||
import { createPluginManager } from '@@/core/plugin'; | ||
|
||
createPluginManager(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require('./dist/test-setup'); |
Oops, something went wrong.