diff --git a/lib/routes/admin-api/state.js b/lib/routes/admin-api/state.js index 3d42bd605a..a2900bcf79 100644 --- a/lib/routes/admin-api/state.js +++ b/lib/routes/admin-api/state.js @@ -69,7 +69,9 @@ class StateController extends Controller { if (downloadFile) { res.attachment(`export-${timestamp}.yml`); } - res.type('yaml').send(YAML.safeDump(data)); + res.type('yaml').send( + YAML.safeDump(data, { skipInvalid: true }), + ); } else { if (downloadFile) { res.attachment(`export-${timestamp}.json`); diff --git a/test/e2e/api/admin/state.e2e.test.js b/test/e2e/api/admin/state.e2e.test.js index 1d60310f16..86b9452c8b 100644 --- a/test/e2e/api/admin/state.e2e.test.js +++ b/test/e2e/api/admin/state.e2e.test.js @@ -39,6 +39,15 @@ test.serial('exports strategies and features as yaml', async t => { .expect(200); }); +test.serial('exports only features as yaml', async t => { + t.plan(0); + const request = await setupApp(stores); + return request + .get('/api/admin/state/export?format=yaml&featureToggles=1') + .expect('Content-Type', /yaml/) + .expect(200); +}); + test.serial('exports strategies and features as attachment', async t => { t.plan(0); const request = await setupApp(stores);