-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
99 additions
and
152 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
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,53 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Main Tests can analyze a valid npm package 1`] = ` | ||
Array [ | ||
Object { | ||
"fanIn": 10000, | ||
"fanOut": 1, | ||
"label": "Stable", | ||
"name": "react", | ||
"stability": 0.00009999000099990002, | ||
}, | ||
] | ||
`; | ||
|
||
exports[`Main Tests can analyze for local packages 1`] = ` | ||
Array [ | ||
Object { | ||
"fanIn": 1, | ||
"fanOut": 0, | ||
"instable": 0, | ||
"label": "Stable", | ||
"name": "a", | ||
}, | ||
Object { | ||
"fanIn": 1, | ||
"fanOut": 1, | ||
"instable": 0.5, | ||
"label": "Normal", | ||
"name": "b", | ||
}, | ||
Object { | ||
"fanIn": 1, | ||
"fanOut": 2, | ||
"instable": 0.6666666666666666, | ||
"label": "Flexible", | ||
"name": "c", | ||
}, | ||
Object { | ||
"fanIn": 1, | ||
"fanOut": 3, | ||
"instable": 0.75, | ||
"label": "Flexible", | ||
"name": "d", | ||
}, | ||
Object { | ||
"fanIn": 1, | ||
"fanOut": 4, | ||
"instable": 0.8, | ||
"label": "Instable", | ||
"name": "e", | ||
}, | ||
] | ||
`; |
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,14 @@ | ||
/** | ||
* This is a sample test suite. | ||
* Replace this with your implementation. | ||
*/ | ||
import { analyze } from './index'; | ||
|
||
describe('Main Tests', () => { | ||
it('can analyze a valid npm package', async () => { | ||
await expect(analyze('react')).resolves.toMatchSnapshot(); | ||
}); | ||
it('can analyze for local packages', async () => { | ||
await expect(analyze('./src/platforms/workspaces/yarn/fixture')).resolves.toMatchSnapshot(); | ||
}); | ||
}); |
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,2 +1,12 @@ | ||
export { analyze as analyzeNpmPackage } from './platforms/npm-package'; | ||
export { analyze as analyzeYarnWorkspaces } from './platforms/workspaces/yarn'; | ||
import { isLocalPath } from './utils/checkLocalPath'; | ||
|
||
import { analyze as analyzeNpmPackage } from './platforms/npm-package'; | ||
import { analyze as analyzeYarnWorkspaces } from './platforms/workspaces/yarn'; | ||
|
||
export function analyze(target: string) { | ||
if (isLocalPath(target)) { | ||
// default to yarn workspaces | ||
return analyzeYarnWorkspaces(target); | ||
} | ||
return analyzeNpmPackage(target); | ||
} |
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 |
---|---|---|
|
@@ -15,13 +15,13 @@ describe('Npm pacakge Tests', () => { | |
{ name: 'loose-envify', version: '^1.1.0' }, | ||
]); | ||
}); | ||
it('should return a dep array for single package', async () => { | ||
it('can analyze for single package', async () => { | ||
await expect(analyze('react')).resolves.toMatchSnapshot(); | ||
}); | ||
it('should return a dep array for multiple packages', async () => { | ||
it('can analyze for multiple packages', async () => { | ||
await expect(analyze('react,vue')).resolves.toMatchSnapshot(); | ||
}); | ||
it('should return a dep array with the package version', async () => { | ||
it('can analyze for multiple packages with the package version', async () => { | ||
await expect(analyze('[email protected],[email protected]')).resolves.toMatchSnapshot(); | ||
}); | ||
}); |
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