From 6d2525669fb85e0c4477e13449560eff3ff27ed9 Mon Sep 17 00:00:00 2001 From: "Mark.Whitfeld" Date: Tue, 13 Jun 2017 07:45:36 +0200 Subject: [PATCH] Workaround in test for eslint sort-keys rule --- .../jest-config/src/__tests__/normalize-test.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/jest-config/src/__tests__/normalize-test.js b/packages/jest-config/src/__tests__/normalize-test.js index 9b7fac0ab71d..8d10cd35eb4a 100644 --- a/packages/jest-config/src/__tests__/normalize-test.js +++ b/packages/jest-config/src/__tests__/normalize-test.js @@ -837,22 +837,27 @@ describe('preset', () => { }); test('merges with options and moduleNameMapper preset is overridden by options', () => { - /* eslint-disable sort-keys */ - // prettier-ignore + // Object initializer not used for properties as a workaround for + // sort-keys eslint rule while specifing properties in + // non-alphabetical order for a better test + const moduleNameMapper = {}; + moduleNameMapper.e = 'ee'; + moduleNameMapper.b = 'bb'; + moduleNameMapper.c = 'cc'; + moduleNameMapper.a = 'aa'; const {options} = normalize( { - moduleNameMapper: {e: 'ee', c: 'cc', b: 'bb', a: 'aa'}, + moduleNameMapper, preset: 'react-native', rootDir: '/root/path/foo', }, {}, ); - /* eslint-enable sort-keys */ expect(options.moduleNameMapper).toEqual([ ['e', 'ee'], - ['c', 'cc'], ['b', 'bb'], + ['c', 'cc'], ['a', 'aa'], ]); });