File tree Expand file tree Collapse file tree 4 files changed +23
-3
lines changed Expand file tree Collapse file tree 4 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ yarn.lock
102102
103103testApp
104104coverage
105+ /config /sync
105106
106107# ###########################
107108# Strapi
Original file line number Diff line number Diff line change @@ -6,6 +6,13 @@ const exec = util.promisify(require('child_process').exec);
66jest . setTimeout ( 20000 ) ;
77
88describe ( 'Test the config-sync CLI' , ( ) => {
9+
10+ afterAll ( async ( ) => {
11+ // Remove the generated files and the DB.
12+ await exec ( 'rm -rf config/sync' ) ;
13+ await exec ( 'rm -rf .tmp' ) ;
14+ } ) ;
15+
916 test ( 'Export' , async ( ) => {
1017 const { stdout } = await exec ( 'yarn cs export -y' ) ;
1118 expect ( stdout ) . toContain ( 'Finished export' ) ;
@@ -19,4 +26,16 @@ describe('Test the config-sync CLI', () => {
1926 const { stdout } = await exec ( 'yarn cs diff' ) ;
2027 expect ( stdout ) . toContain ( 'No differences between DB and sync directory' ) ;
2128 } ) ;
29+ test ( 'Non-empty diff returns 1' , async ( ) => {
30+ await exec ( 'rm -rf config/sync/admin-role.strapi-author.json' ) ;
31+ // Work around Jest not supporting custom error matching.
32+ // https://github.com/facebook/jest/issues/8140
33+ let error ;
34+ try {
35+ await exec ( 'yarn cs diff' ) ;
36+ } catch ( e ) {
37+ error = e ;
38+ }
39+ expect ( error ) . toHaveProperty ( 'code' , 1 ) ;
40+ } ) ;
2241} ) ;
Original file line number Diff line number Diff line change 1919 "@strapi/plugin-users-permissions" : " ^4.0.0" ,
2020 "@strapi/strapi" : " ^4.0.0" ,
2121 "sqlite3" : " 5.0.2" ,
22- "strapi-plugin-config-sync" : " boazpoolman/strapi-plugin-config-sync "
22+ "strapi-plugin-config-sync" : " ./.. "
2323 },
2424 "author" : {
2525 "name" : " A Strapi developer"
Original file line number Diff line number Diff line change @@ -269,7 +269,7 @@ program
269269 { color : true } ,
270270 ) ) ;
271271
272- process . exit ( 0 ) ;
272+ process . exit ( 1 ) ;
273273 }
274274
275275 // Init table.
@@ -283,7 +283,7 @@ program
283283 // Print table.
284284 console . log ( table . toString ( ) ) ;
285285
286- process . exit ( 0 ) ;
286+ process . exit ( 1 ) ;
287287 } ) ;
288288
289289program . parseAsync ( process . argv ) ;
You can’t perform that action at this time.
0 commit comments