-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normalize file copy destination when creating hoist manifests
- Loading branch information
1 parent
a1c3aeb
commit 7fca0c8
Showing
3 changed files
with
37 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* @flow */ | ||
|
||
import path from 'path'; | ||
import PackageHoister, {HoistManifest} from '../src/package-hoister.js'; | ||
|
||
const mockConfig = { | ||
cwd: __dirname, | ||
getFolder(): string { | ||
return 'node_modules'; | ||
}, | ||
}; | ||
|
||
test('Produces valid destination paths for scoped modules', () => { | ||
const expected = path.join(__dirname, './node_modules/@scoped/dep'); | ||
const scopedPackageName = '@scoped/dep'; | ||
|
||
const key = scopedPackageName; | ||
const parts = [scopedPackageName]; | ||
const pkg = {_reference: {}}; | ||
const loc = null; | ||
const info = new HoistManifest(key, parts, pkg, loc); | ||
|
||
const tree = new Map([ | ||
['@scoped/dep', info], | ||
]); | ||
|
||
const packageHoister = new PackageHoister(mockConfig); | ||
packageHoister.tree = tree; | ||
|
||
const result = packageHoister.init(); | ||
const [actual] = result[0]; | ||
|
||
expect(actual).toEqual(expected); | ||
}); |
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