@@ -45,6 +45,9 @@ public function testSynchronizeNoPackage()
4545 '@symfony/stimulus-bridge ' => '^1.0.0 ' ,
4646 'stimulus ' => '^1.1.1 ' ,
4747 ],
48+ 'browserslist ' => [
49+ 'defaults ' ,
50+ ],
4851 ],
4952 json_decode (file_get_contents ($ this ->tempDir .'/package.json ' ), true )
5053 );
@@ -71,6 +74,9 @@ public function testSynchronizeExistingPackage()
7174 '@symfony/stimulus-bridge ' => '^1.0.0 ' ,
7275 'stimulus ' => '^1.1.1 ' ,
7376 ],
77+ 'browserslist ' => [
78+ 'defaults ' ,
79+ ],
7480 ],
7581 json_decode (file_get_contents ($ this ->tempDir .'/package.json ' ), true )
7682 );
@@ -109,9 +115,12 @@ public function testSynchronizeNewPackage()
109115 "@symfony/new-package": "file:vendor/symfony/new-package/assets",
110116 "@symfony/stimulus-bridge": "^1.0.0",
111117 "stimulus": "^1.1.1"
112- }
118+ },
119+ "browserslist": [
120+ "defaults"
121+ ]
113122} ' ,
114- file_get_contents ($ this ->tempDir .'/package.json ' )
123+ trim ( file_get_contents ($ this ->tempDir .'/package.json ' ) )
115124 );
116125
117126 $ this ->assertSame (
@@ -142,4 +151,25 @@ public function testSynchronizeNewPackage()
142151 json_decode (file_get_contents ($ this ->tempDir .'/assets/controllers.json ' ), true )
143152 );
144153 }
154+
155+ public function testArrayFormattingHasNotChanged ()
156+ {
157+ $ this ->synchronizer ->synchronize (['symfony/existing-package ' ]);
158+
159+ // Should keep existing array formatting
160+ $ this ->assertSame (
161+ '{
162+ "name": "symfony/fixture",
163+ "devDependencies": {
164+ "@symfony/existing-package": "file:vendor/symfony/existing-package/Resources/assets",
165+ "@symfony/stimulus-bridge": "^1.0.0",
166+ "stimulus": "^1.1.1"
167+ },
168+ "browserslist": [
169+ "defaults"
170+ ]
171+ } ' ,
172+ trim (file_get_contents ($ this ->tempDir .'/package.json ' ))
173+ );
174+ }
145175}
0 commit comments