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

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

@@ -2,7 +2,7 @@ import * as React from 'react';
2 2
 import { ComponentProvider } from 'react-native';
3 3
 import merge from 'lodash/merge'
4 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 7
 import { Store } from './Store';
8 8
 import { ComponentEventsObserver } from '../events/ComponentEventsObserver';

+ 10
- 7
package.json View File

@@ -98,17 +98,20 @@
98 98
     },
99 99
     "roots": [
100 100
       "<rootDir>/node_modules/",
101
-      "<rootDir>/lib/dist/",
101
+      "<rootDir>/lib/src/",
102 102
       "<rootDir>/integration/"
103 103
     ],
104 104
     "collectCoverageFrom": [
105
-      "lib/dist/**/*.js",
105
+      "!lib/src/**/*.js",
106 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 115
       "!integration/**/*.test.*",
113 116
       "!integration/*.test.*"
114 117
     ],

+ 0
- 28
wallaby.js View File

@@ -8,34 +8,6 @@ module.exports = function (wallaby) {
8 8
     },
9 9
 
10 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 11
     setup: (w) => {
40 12
       w.testFramework.configure(require('./package.json').jest);
41 13
     }