@@ -22,7 +22,7 @@ it('accepts byte-identical package trees', () => {
2222 'package.json' : '{}\n' ,
2323 'dist/index.js' : 'export {};\n' ,
2424 } ) ;
25- expect ( comparePackageTrees ( local , published ) ) . toEqual ( [ ] ) ;
25+ expect ( comparePackageTrees ( local , published ) ) . toEqual ( [ ] ) ;
2626} ) ;
2727
2828it ( 'reports missing, unexpected, and changed package bytes' , ( ) => {
@@ -36,9 +36,37 @@ it('reports missing, unexpected, and changed package bytes', () => {
3636 'dist/index.js' : 'published\n' ,
3737 'dist/only-published.js' : 'published\n' ,
3838 } ) ;
39- expect ( comparePackageTrees ( local , published ) ) . toEqual ( [
39+ expect ( comparePackageTrees ( local , published ) ) . toEqual ( [
4040 'published package differs at dist/index.js' ,
4141 'published package is missing dist/only-local.js' ,
4242 'published package has unexpected dist/only-published.js' ,
4343 ] ) ;
4444} ) ;
45+
46+ it ( 'ignores package.json object-key insertion order only' , ( ) => {
47+ const local = tree ( {
48+ 'package.json' : JSON . stringify ( {
49+ name : '@astryxdesign/core' ,
50+ devDependencies : { react : '19.2.7' , cli : '0.6.5' } ,
51+ } ) ,
52+ } ) ;
53+ const published = tree ( {
54+ 'package.json' : JSON . stringify ( {
55+ devDependencies : { cli : '0.6.5' , react : '19.2.7' } ,
56+ name : '@astryxdesign/core' ,
57+ } ) ,
58+ } ) ;
59+ expect ( comparePackageTrees ( local , published ) ) . toEqual ( [ ] ) ;
60+ } ) ;
61+
62+ it ( 'still rejects package.json value and array-order changes' , ( ) => {
63+ const local = tree ( {
64+ 'package.json' : JSON . stringify ( { files : [ 'dist' , 'src' ] , version : '0.6.5' } ) ,
65+ } ) ;
66+ const published = tree ( {
67+ 'package.json' : JSON . stringify ( { files : [ 'src' , 'dist' ] , version : '0.6.4' } ) ,
68+ } ) ;
69+ expect ( comparePackageTrees ( local , published ) ) . toEqual ( [
70+ 'published package differs at package.json' ,
71+ ] ) ;
72+ } ) ;
0 commit comments