rjz / typescript-react-redux

A TypeScript-enabled react/redux application
https://rjzaworski.com/c/typescript
Other
124 stars 24 forks source link

most test cases failing due to type errors #12

Closed veeramarni closed 7 years ago

veeramarni commented 7 years ago

Noticed all the test cases are failing due to type errors.

actions.loadCount()(dispatch)

ts] Supplied parameters do not match any signature of call target.
const loadCount: (request: null) => (dispatch: Dispatch<{
    counter: {
        value: number;
    };
    isSaving: boolean;
    isLoading: boolean;
    error: string;
}>) => void

api.save.mockReturnValue(Promise.resolve(null))

[ts] Property 'mockReturnValue' does not exist on type '(counter: { value: number; }) => Promise<null>'.
any
rjz commented 7 years ago

Thanks, @veeramarni! Since these were passing fairly recently, could you confirm a couple of details to aid diagnosis?

  1. What command are you using to run the tests?
  2. How does $ npm ls --depth=0 look for your local checkout?

Definitely not hard to imagine some issues here, though—the specs are pretty cavalier with their type signatures.

veeramarni commented 7 years ago

The checks are failing when using latest typescript package. For above issues, if you just have null argument by changing to actions.loadCount(null)(dispatch) it resolves that. But some checks fails due to missing functions such as mockReturnVaule which is missing here

sample-browser-server@0.0.1 /Users/veeramarni/Documents/eclipse/workspace/phoneapps/development/projects/fullstack-pro/packages/sa
mple-browser-server
├── @types/jest@19.2.2
├── @types/minimist@1.2.0
├── @types/mocha@2.2.40
├── @types/node@7.0.12
├── @types/react@15.0.21
├── @types/react-dom@0.14.23
├── @types/react-redux@4.4.38
├── @types/redux@3.6.0
├── @types/semver@5.3.31
├── @types/sinon@2.1.2
├── babel-loader@6.2.5 extraneous
├── babel-preset-es2015@6.14.0 extraneous
├── eslint@3.19.0
├── eslint-plugin-graphql@0.6.1
├── http-server@0.9.0 extraneous
├── jest@19.0.2
├── jest-cli@19.0.2
├── mocha@3.2.0
├── react@15.4.2
├── react-addons-test-utils@15.4.2
├── react-apollo@1.0.0
├── react-dom@15.4.2
├── react-redux@5.0.3
├── redux@3.6.0
├── redux-thunk@2.2.0
├── reselect@3.0.0
├── rimraf@2.6.1
├── ts-jest@19.0.7
├── UNMET PEER DEPENDENCY typescript@^2.1.0 || ^2.2.0-dev
├── watch-http-server@0.7.6 extraneous
├── UNMET PEER DEPENDENCY webpack@2.3.3
├── webpack-dev-server@2.4.2
├── webpack-fail-plugin@1.0.6
├── webpack-visualizer-plugin@0.1.11
└── zakalwe@1.0.0 (git+https://github.com/rjz/zakalwe.git#8ba49775a67c64598e3805dc3d5f2f7c007df2b6)
rjz commented 7 years ago

Thanks again for your help tracking this down. I haven't been able to repro the issue via npm test, but I saw a number of issues when I tried to compile the specs directly:

$ find 'src' -name '*_spec.ts' -exec ./node_modules/.bin/tsc --lib dom,es6 {} \;

I've pushed a branch that fixes these; when you have a moment, would you mind checking to see whether it gets your build back up and running? If it does, we'll merge it in and make the world a better place for everyone!

rjz commented 7 years ago

Closing this out for now, but will be happy to reopen if the types in #12 don't check out.

For the sake of completeness, https://github.com//kulshekhar/ts-jest/issues/107 also reports (and documents a fix) for a maybe-related issue when working with Webstorm.