Questions tagged as 'jest'

1
answer

How to integrate Jest and Flow

I know some people use Jest together with Flow , even more because it's from Facebook, I have a React project, and I'm trying to do this integration, but Jest does not recognize Flow typing tags. Error Message FAIL __tests__/c...
asked by 11.08.2017 / 21:08
0
answers

How to refactor JS legacy to implement Unit Tests?

I have a WordPress site with lots of JS files that were not structured to be tested - they were not written as modules that can be imported nor is there a app.js that loads all of them as a framework. The files are only compiled and mi...
asked by 27.06.2018 / 14:47
1
answer

How to capture an event in a stub? [vue-test-utils]

I'm trying to test an event similar to this: // template: <form @submit.prevent="save"></form> const save = jest.fn() const wrapper = mount(MyComponent, {methods: { save }}) wrapper.find('form').trigger('submit.prevent') expect(sav...
asked by 23.11.2018 / 14:32
1
answer

Unit test of a javascript fetch function with jest or mocha

I'm starting TDD studies and came across a function like this: const fetchexample = callback => { fetch('/token', { method: 'POST', body: 'user=teste' }).then(res => res.json()).then(json => { localStorage.setItem('tok...
asked by 09.11.2017 / 12:56
1
answer

Jest ignoring package.json specifications

I am implementing tests in my web application on react with the jest. Since it was started with the "create-react-app" it was easy to configure the environment. But for some reason the jest seems to ignore package.json specifications ... { "...
asked by 10.09.2017 / 21:40
0
answers

Ignore unit test files using jest and webpack

Talk, guys, I'm having a hard time ignoring my test files when building my application. How do I configure the Web Pack to skip test files?     
asked by 17.08.2018 / 23:53