@@ -9,11 +9,11 @@ describe('package-manifest', () => {
99 it ( 'reads a minimal package manifest, expanding it by filling in values for optional fields' , async ( ) => {
1010 await withSandbox ( async ( sandbox ) => {
1111 const manifestPath = path . join ( sandbox . directoryPath , 'package.json' ) ;
12- const unvalidatedManifest = {
12+ const unvalidated = {
1313 name : 'foo' ,
1414 version : '1.2.3' ,
1515 } ;
16- const validatedManifest = {
16+ const validated = {
1717 name : 'foo' ,
1818 version : new SemVer ( '1.2.3' ) ,
1919 workspaces : [ ] ,
@@ -24,27 +24,24 @@ describe('package-manifest', () => {
2424 optionalDependencies : { } ,
2525 peerDependencies : { } ,
2626 } ;
27- await fs . promises . writeFile (
28- manifestPath ,
29- JSON . stringify ( unvalidatedManifest ) ,
30- ) ;
27+ await fs . promises . writeFile ( manifestPath , JSON . stringify ( unvalidated ) ) ;
3128
3229 expect ( await readPackageManifest ( manifestPath ) ) . toStrictEqual ( {
33- unvalidatedManifest ,
34- validatedManifest ,
30+ unvalidated ,
31+ validated ,
3532 } ) ;
3633 } ) ;
3734 } ) ;
3835
3936 it ( 'reads a package manifest where "private" is true' , async ( ) => {
4037 await withSandbox ( async ( sandbox ) => {
4138 const manifestPath = path . join ( sandbox . directoryPath , 'package.json' ) ;
42- const unvalidatedManifest = {
39+ const unvalidated = {
4340 name : 'foo' ,
4441 version : '1.2.3' ,
4542 private : true ,
4643 } ;
47- const validatedManifest = {
44+ const validated = {
4845 name : 'foo' ,
4946 version : new SemVer ( '1.2.3' ) ,
5047 workspaces : [ ] ,
@@ -55,27 +52,24 @@ describe('package-manifest', () => {
5552 optionalDependencies : { } ,
5653 peerDependencies : { } ,
5754 } ;
58- await fs . promises . writeFile (
59- manifestPath ,
60- JSON . stringify ( unvalidatedManifest ) ,
61- ) ;
55+ await fs . promises . writeFile ( manifestPath , JSON . stringify ( unvalidated ) ) ;
6256
6357 expect ( await readPackageManifest ( manifestPath ) ) . toStrictEqual ( {
64- unvalidatedManifest ,
65- validatedManifest ,
58+ unvalidated ,
59+ validated ,
6660 } ) ;
6761 } ) ;
6862 } ) ;
6963
7064 it ( 'reads a package manifest where "private" is false' , async ( ) => {
7165 await withSandbox ( async ( sandbox ) => {
7266 const manifestPath = path . join ( sandbox . directoryPath , 'package.json' ) ;
73- const unvalidatedManifest = {
67+ const unvalidated = {
7468 name : 'foo' ,
7569 version : '1.2.3' ,
7670 private : false ,
7771 } ;
78- const validatedManifest = {
72+ const validated = {
7973 name : 'foo' ,
8074 version : new SemVer ( '1.2.3' ) ,
8175 workspaces : [ ] ,
@@ -86,22 +80,19 @@ describe('package-manifest', () => {
8680 optionalDependencies : { } ,
8781 peerDependencies : { } ,
8882 } ;
89- await fs . promises . writeFile (
90- manifestPath ,
91- JSON . stringify ( unvalidatedManifest ) ,
92- ) ;
83+ await fs . promises . writeFile ( manifestPath , JSON . stringify ( unvalidated ) ) ;
9384
9485 expect ( await readPackageManifest ( manifestPath ) ) . toStrictEqual ( {
95- unvalidatedManifest ,
96- validatedManifest ,
86+ unvalidated ,
87+ validated ,
9788 } ) ;
9889 } ) ;
9990 } ) ;
10091
10192 it ( 'reads a package manifest where optional fields are fully provided' , async ( ) => {
10293 await withSandbox ( async ( sandbox ) => {
10394 const manifestPath = path . join ( sandbox . directoryPath , 'package.json' ) ;
104- const unvalidatedManifest = {
95+ const unvalidated = {
10596 name : 'foo' ,
10697 version : '1.2.3' ,
10798 workspaces : [ 'packages/*' ] ,
@@ -122,7 +113,7 @@ describe('package-manifest', () => {
122113 foo : 'bar' ,
123114 } ,
124115 } ;
125- const validatedManifest = {
116+ const validated = {
126117 name : 'foo' ,
127118 version : new SemVer ( '1.2.3' ) ,
128119 workspaces : [ 'packages/*' ] ,
@@ -143,22 +134,19 @@ describe('package-manifest', () => {
143134 foo : 'bar' ,
144135 } ,
145136 } ;
146- await fs . promises . writeFile (
147- manifestPath ,
148- JSON . stringify ( unvalidatedManifest ) ,
149- ) ;
137+ await fs . promises . writeFile ( manifestPath , JSON . stringify ( unvalidated ) ) ;
150138
151139 expect ( await readPackageManifest ( manifestPath ) ) . toStrictEqual ( {
152- unvalidatedManifest ,
153- validatedManifest ,
140+ unvalidated ,
141+ validated ,
154142 } ) ;
155143 } ) ;
156144 } ) ;
157145
158146 it ( 'reads a package manifest where dependencies fields are provided but empty' , async ( ) => {
159147 await withSandbox ( async ( sandbox ) => {
160148 const manifestPath = path . join ( sandbox . directoryPath , 'package.json' ) ;
161- const unvalidatedManifest = {
149+ const unvalidated = {
162150 name : 'foo' ,
163151 version : '1.2.3' ,
164152 private : true ,
@@ -168,7 +156,7 @@ describe('package-manifest', () => {
168156 optionalDependencies : { } ,
169157 peerDependencies : { } ,
170158 } ;
171- const validatedManifest = {
159+ const validated = {
172160 name : 'foo' ,
173161 version : new SemVer ( '1.2.3' ) ,
174162 workspaces : [ ] ,
@@ -179,27 +167,24 @@ describe('package-manifest', () => {
179167 optionalDependencies : { } ,
180168 peerDependencies : { } ,
181169 } ;
182- await fs . promises . writeFile (
183- manifestPath ,
184- JSON . stringify ( unvalidatedManifest ) ,
185- ) ;
170+ await fs . promises . writeFile ( manifestPath , JSON . stringify ( unvalidated ) ) ;
186171
187172 expect ( await readPackageManifest ( manifestPath ) ) . toStrictEqual ( {
188- unvalidatedManifest ,
189- validatedManifest ,
173+ unvalidated ,
174+ validated ,
190175 } ) ;
191176 } ) ;
192177 } ) ;
193178
194179 it ( 'reads a package manifest where the "workspaces" field is provided but empty' , async ( ) => {
195180 await withSandbox ( async ( sandbox ) => {
196181 const manifestPath = path . join ( sandbox . directoryPath , 'package.json' ) ;
197- const unvalidatedManifest = {
182+ const unvalidated = {
198183 name : 'foo' ,
199184 version : '1.2.3' ,
200185 workspaces : [ ] ,
201186 } ;
202- const validatedManifest = {
187+ const validated = {
203188 name : 'foo' ,
204189 version : new SemVer ( '1.2.3' ) ,
205190 workspaces : [ ] ,
@@ -210,14 +195,11 @@ describe('package-manifest', () => {
210195 optionalDependencies : { } ,
211196 peerDependencies : { } ,
212197 } ;
213- await fs . promises . writeFile (
214- manifestPath ,
215- JSON . stringify ( unvalidatedManifest ) ,
216- ) ;
198+ await fs . promises . writeFile ( manifestPath , JSON . stringify ( unvalidated ) ) ;
217199
218200 expect ( await readPackageManifest ( manifestPath ) ) . toStrictEqual ( {
219- unvalidatedManifest ,
220- validatedManifest ,
201+ unvalidated ,
202+ validated ,
221203 } ) ;
222204 } ) ;
223205 } ) ;
0 commit comments