-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
I have a small template project with Mobx 4.2 / Typescript which works fine, including testing store with Jest.
I updated Mobx dependency to 5.0.0-beta.6 and the code seems to work otherwise fine but testing the store gives an error "TypeError: allKeys[x].match is not a function". The row which fails just tests TypeScript Array equality to [].
Output when running 'yarn' and then 'yarn test':
FAIL src/stores/app/index.test.ts
● AppStore › addCounterNote should add new note to notes array beginning
TypeError: allKeys[x].match is not a function
6 |
7 | expect(store.counter).toEqual(0)
> 8 | expect(store.notes).toEqual([])
9 | store.addCounterNote()
10 | expect(store.counter).toEqual(1)
11 | expect(store.notes.length).toEqual(1)
at Object.<anonymous> (src/stores/app/index.test.ts:8:25)
A repository which reproduces the problem can be found at https://github.com/tkivela/react-ts-mobx-template-v5jestproblem
I'm not sure if this is a Mobx problem but the fact that same works with Mobx 4.2 implies that the problem could atleast be a compatibility issue which should be documented somewhere in v5 docs.