Browse Source

Fix wallaby (#5917)

* Fix wallaby

* Add coverage on tsx files

* Update lib/src/commands/OptionsProcessor.test.ts

Co-authored-by: Guy Carmeli <guyca@users.noreply.github.com>
Yogev Ben David 5 years ago
parent
commit
31c9f5cd9b
No account linked to committer's email address
4 changed files with 15 additions and 37 deletions
  1. 4
    1
      lib/src/commands/OptionsProcessor.test.ts
  2. 1
    1
      lib/src/components/ComponentWrapper.tsx
  3. 10
    7
      package.json
  4. 0
    28
      wallaby.js

+ 4
- 1
lib/src/commands/OptionsProcessor.test.ts View File

6
 import { ColorService } from '../adapters/ColorService';
6
 import { ColorService } from '../adapters/ColorService';
7
 import { AssetService } from '../adapters/AssetResolver';
7
 import { AssetService } from '../adapters/AssetResolver';
8
 
8
 
9
+jest.mock('lodash/uniqueId', () => {
10
+  return (prefix: string) => `${prefix}1`
11
+})
12
+
9
 describe('navigation options', () => {
13
 describe('navigation options', () => {
10
   let uut: OptionsProcessor;
14
   let uut: OptionsProcessor;
11
   const mockedStore = mock(Store) as Store;
15
   const mockedStore = mock(Store) as Store;
86
     const options = { topBar: { title: { component: { name: 'a' } } } };
90
     const options = { topBar: { title: { component: { name: 'a' } } } };
87
 
91
 
88
     uut.processOptions(options);
92
     uut.processOptions(options);
89
-
90
     expect(options).toEqual({
93
     expect(options).toEqual({
91
       topBar: { title: { component: { name: 'a', componentId: 'CustomComponent1' } } },
94
       topBar: { title: { component: { name: 'a', componentId: 'CustomComponent1' } } },
92
     });
95
     });

+ 1
- 1
lib/src/components/ComponentWrapper.tsx View File

2
 import { ComponentProvider } from 'react-native';
2
 import { ComponentProvider } from 'react-native';
3
 import merge from 'lodash/merge'
3
 import merge from 'lodash/merge'
4
 import { polyfill } from 'react-lifecycles-compat';
4
 import { polyfill } from 'react-lifecycles-compat';
5
-import hoistNonReactStatics = require('hoist-non-react-statics');
5
+import hoistNonReactStatics from 'hoist-non-react-statics';
6
 
6
 
7
 import { Store } from './Store';
7
 import { Store } from './Store';
8
 import { ComponentEventsObserver } from '../events/ComponentEventsObserver';
8
 import { ComponentEventsObserver } from '../events/ComponentEventsObserver';

+ 10
- 7
package.json View File

98
     },
98
     },
99
     "roots": [
99
     "roots": [
100
       "<rootDir>/node_modules/",
100
       "<rootDir>/node_modules/",
101
-      "<rootDir>/lib/dist/",
101
+      "<rootDir>/lib/src/",
102
       "<rootDir>/integration/"
102
       "<rootDir>/integration/"
103
     ],
103
     ],
104
     "collectCoverageFrom": [
104
     "collectCoverageFrom": [
105
-      "lib/dist/**/*.js",
105
+      "!lib/src/**/*.js",
106
       "integration/**/*.js",
106
       "integration/**/*.js",
107
-      "!lib/dist/index.js",
108
-      "!lib/dist/Navigation.js",
109
-      "!lib/dist/adapters/**/*",
110
-      "!lib/dist/interfaces/**/*",
111
-      "!lib/dist/**/*.test.*",
107
+      "lib/src/**/*.ts",
108
+      "lib/src/**/*.tsx",
109
+      "!lib/src/index.ts",
110
+      "!lib/src/types.ts",
111
+      "!lib/src/Navigation.ts",
112
+      "!lib/src/adapters/**/*",
113
+      "!lib/src/interfaces/**/*",
114
+      "!lib/src/**/*.test.*",
112
       "!integration/**/*.test.*",
115
       "!integration/**/*.test.*",
113
       "!integration/*.test.*"
116
       "!integration/*.test.*"
114
     ],
117
     ],

+ 0
- 28
wallaby.js View File

8
     },
8
     },
9
 
9
 
10
     testFramework: 'jest',
10
     testFramework: 'jest',
11
-
12
-    files: [
13
-      'package.json',
14
-      'lib/src/**/*.js',
15
-      'lib/src/**/*.ts',
16
-      'lib/src/**/*.tsx',
17
-      '!lib/src/**/*.test.tsx',
18
-      '!lib/src/**/*.test.js',
19
-      '!lib/src/**/*.test.ts',
20
-      'integration/**/*.js',
21
-      '!integration/**/*.test.js'
22
-    ],
23
-
24
-    tests: [
25
-      'lib/src/**/*.test.js',
26
-      'lib/src/**/*.test.ts',
27
-      'lib/src/**/*.test.tsx',
28
-      'integration/**/*.test.js'
29
-    ],
30
-
31
-    compilers: {
32
-      '**/*.js': wallaby.compilers.babel(babelOptions),
33
-      '**/*.ts?(x)': wallaby.compilers.typeScript({
34
-        module: 'commonjs',
35
-        jsx: 'React'
36
-      })
37
-    },
38
-
39
     setup: (w) => {
11
     setup: (w) => {
40
       w.testFramework.configure(require('./package.json').jest);
12
       w.testFramework.configure(require('./package.json').jest);
41
     }
13
     }