-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(preset): add test cases for getHostPkgAlias util
- Loading branch information
1 parent
f61e226
commit c054f5d
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
packages/preset-dumi/src/utils/fixtures/alias-normal/package.json
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,3 @@ | ||
{ | ||
"name": "normal" | ||
} |
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,22 @@ | ||
import path from 'path'; | ||
import getHostPkgAlias from './getHostPkgAlias'; | ||
|
||
describe('getHostPkgAlias', () => { | ||
it('get normal pkg alias', () => { | ||
const pkgPath = path.join(__dirname, 'fixtures/alias-normal'); | ||
const { name: pkgName } = require(path.join(pkgPath, 'package.json')); | ||
|
||
expect(getHostPkgAlias({ cwd: pkgPath })).toEqual([[pkgName, pkgPath]]); | ||
}); | ||
|
||
it('get lerna pkg alias', () => { | ||
const alias = getHostPkgAlias({ cwd: path.join(__dirname, '../../../../') }); | ||
|
||
expect(alias.map(([name]) => name)).toEqual([ | ||
'@umijs/create-dumi-app', | ||
'@umijs/create-dumi-lib', | ||
'dumi', | ||
'@umijs/preset-dumi', | ||
]); | ||
}); | ||
}); |