File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change
1
+ import { expect } from 'chai' ;
2
+ import { listNpmPackages } from './npm-packages' ;
3
+
4
+ describe ( 'listNpmPackages' , ( ) => {
5
+ it ( 'lists packages' , ( ) => {
6
+ const packages = listNpmPackages ( ) ;
7
+ expect ( packages . length ) . to . be . greaterThan ( 1 ) ;
8
+ for ( const { name, version } of packages ) {
9
+ expect ( name ) . to . be . a ( 'string' ) ;
10
+ expect ( version ) . to . be . a ( 'string' ) ;
11
+ }
12
+ } ) ;
13
+ } ) ;
Original file line number Diff line number Diff line change @@ -55,16 +55,17 @@ export function publishNpmPackages(): void {
55
55
} ) ;
56
56
}
57
57
58
- function listNpmPackages ( ) : { version : string } [ ] {
58
+ export function listNpmPackages ( ) : { name : string ; version : string } [ ] {
59
59
const lernaListOutput = spawn . sync (
60
60
LERNA_BIN , [
61
61
'list' ,
62
62
'--json' ,
63
63
] ,
64
64
{
65
- cwd : PROJECT_ROOT
65
+ cwd : PROJECT_ROOT ,
66
+ encoding : 'utf8'
66
67
}
67
- ) . toString ( ) ;
68
+ ) ;
68
69
69
- return JSON . parse ( lernaListOutput ) ;
70
+ return JSON . parse ( lernaListOutput . stdout ) ;
70
71
}
You can’t perform that action at this time.
0 commit comments