#jest
Everyone wants to add tools to the dev env, but nobody wants to support their team when they break the precommit hooks. #eslint #typescript #jest #tdd #danger #testCoverage #linting #husky
I've managed to get the #Jest tests running, though about half are now having issues with paths and not finding modules.
Para aquellos que usen Jest en su proyecto y además lo tengan integrado en la CI recomiendo encarecidamente actualizar a la versión 28 ya que en dicha versión añadieron la posibilidad de usar shards, bien pues aprovechando esta funcionalidad podemos dividir y ejecutar dichas partes en paralelo dentro de nuestra CI para reducir considerablemente el tiempo de ejecución de nuestros tests 🚀
Dejo artículo dónde se muestra dicha implementación: https://remarkablemark.org/blog/2022/05/13/jest-shard-test-github-actions/
I just finished the final review of my new book (coming in May): JavaScript All-In-One For Dummies. This one has been my dream to write for over a decade, and I've been working on it for 10 months.
When I used to hire junior developers, I'd find myself (and them) overwhelmed with how much they had to know to be to be productive. This book addresses that.
#JavaScript #Git #vscode #React #Vue #Svelte #ESLint #Jest #Node #webapi #express #mongodb #webpack #babel #vite #rest #jwt #micdrop
#JavaScript and #nextjs friends. #Next allows for async server side components. react-testing-library and #jest seem to very much hate the idea of a `Promise<JSX.Element>` for any rendering. Any thoughts on proper ways to test async server components?
Having made significant progress on a large migration from #Jest to #Vitest, I can add our experience as an anecdote to the conversation about performance between the two!
Our component library saw about a 20% improvement in total time to run the tests, from about a little over 50 seconds to about 40. Not a huge win, but not bad!
An app that did the same migration showed even better improvements though, reducing the time spent by half; what used to take two minutes now takes less than one!

I really like Java and Eclipse, but #TypeScript with #Jest in #VSCode, executing my tests on every change in the background and showing me missing test coverage right in the text editor is hard to beat.
Spent the end of last week helping our frontend devs speed up their build/test/deploy times. I'm a bit rusty on #typescript and #javascript in general but it seems every year these systems add another layer of complexity. It's been a fun couple of days though poking around #yarn #webpack and #jest and hopefully the team are happy with significantly faster builds.
So I've been doing a bit of research into #web #UnitTesting #tooling (#Jest, #Vitest, #Jasmine, #Karma, #WebTestRunner, ...).
I'm curious if there's any interest in a blog post on some of my takeaways about aspects like:
* Test runners vs test frameworks.
* Browser-based runners vs Node-based runners.
* Changes in the ecosystem.
* Future directions of JS unit testing.
* ...
Day 246 #100daysofhomelab
Spent the time updating littlelink-server and fixing unit tests. Not the most exciting work, but necessary nonetheless. Fresh docker container building in CI now!
https://github.com/techno-tim/littlelink-server
#opensource #homelab #nodejs #react #node #reactjs #razzle #unitests #jest #docker #dockercontainer #selfhost #selfhosting #selfhosted #ci #cd #cicd
I asked #ChatGPT what some of the best articles on testing #Vue 2.x using #Jest were and it responded...all of the links are broken. 😂
Don't get me wrong, I'm still querying ChatGPT when Google isn't providing me with the desired answers
BUT what I'd really like is some #HumanAugmented #Search 😉

@eliajf I was mostly looking into test runners moreso than test frameworks.
#Jest is still dominant by a huge amount, but #WebTestRunner and #JasmineBrowserRunner looked interesting to me. I've had good experiences with WTR in the past, but haven't tried Jasmine's browser runner.
https://modern-web.dev/docs/test-runner/overview/
https://www.npmjs.com/package/jasmine-browser-runner
Working on fixing a bunch of failing tests? Try using --bail to stop Jest after the first failing test so you can tackle them one by one. #jest #javascript #react
Episode 23/04: https://youtu.be/Vm7etXJGNoQ
TypeScript released the beta for version 5, with stable support for decorators. They are slightly different from the experimental ones we use in Angular. Furthermore, Minko Gechev gave an update about Angular's roadmap. The focus in 2023 is on reactivity and server-side rendering.
#TypeScript 5 Beta: https://devblogs.microsoft.com/typescript/announcing-typescript-5-0-beta/
#Angular Roadmap 2023: https://youtu.be/7dm4Gif7A5o
Minor Releases:
- #NgRx 15.2 - support for functional creators: https://github.com/ngrx/platform/blob/master/CHANGELOG.md#1520-2023-01-26
- #Nx 15.6: https://github.com/nrwl/nx/releases/tag/15.6.0
- #Cypress 12.4: https://docs.cypress.io/guides/references/changelog#12-4-0
- #Playwright 1.30: https://github.com/microsoft/playwright/releases/tag/v1.30.0
- #Jest 29.4: https://github.com/facebook/jest/releases/tag/v29.4.0

Just fixing a warning from Jest has improved a unit test suite from 120 seconds of runtime down to 25. Don't ignore your warnings folks! #programming #testing #jest
I like it a lot this book to learn #React and testing with #Jest: https://www.packtpub.com/product/mastering-react-test-driven-development-second-edition/9781803247120 #Javascript
One of the slightly punk ideas I had for JestSpec was to allow specifications written outside of pure Gherkin syntax, so you could write more naturally if you wanted to.
If you use #Jest with #JavaScript or #TypeScript you can use JestSpec to add #Gherkin, or natural language, specification files.
Go write some test prose!
https://www.stevefenton.co.uk/blog/2023/01/using-jestspec-without-gherkin/
Handling errors from async methods in #Jest https://bit.ly/3UNZHbK #bitBlog
Spent some time trying to get #Jest to work for our #ExpressJS app that runs in a #DockerCompose set-up. Failing miserably. I know it shouldn’t be this hard. I think I’m going to give up on the approach I was trying and just focus on endpoint testing, if I can figure out how to do that. I miss #Laravel at times like this.
Hier je suis tombé sur cette réponse très instructive sur #stackoverflow concernant les cas d'usages des fonctions describe et it dans #jest (un framework de test #javascript)
En résumé: describe permet de séparer les tests en scénarios, quand it sert à marquer une assertion unitaire dans le cadre d'un scénario de test
Rendez vous sur le lien suivant pour un exemple concret et plus d'explications
🇬🇧 https://stackoverflow.com/questions/32055287/what-is-the-difference-between-describe-and-it-in-jest
Handling errors from async methods in #Jest https://bit.ly/3Bbjt9w
Anyone have any recommendations on react component testing and mocking API-responses?
I'd preferably like to mock out the hook calling the query. Bonus if there are helps specifically for react-query
Published my first #npm #ESLint package. I’ve contributed to ESLint before, but never actually published my own package.
It was not bad at all. It took about 2 hours.
The rule is really simple and not useful to most people, but it was a nice way to ensure that we don’t forget to add #a11y #axe #jest tests to our test files and I can imagine it being useful for other similar code-hygiene patterns some day: https://github.com/katerberg/eslint-plugin-file-contains
Jest is a delightful JavaScript Testing Framework with a focus on simplicity.
Writing tests for this with ts-mocha instead of #jest, and at first glance it feels so much faster. I wonder the effort required is to convert a larger codebase...
Would love to hear from anybody else using ts-mocha instead of jest for #TypeScript.
Mam ochotę rozpocząć programistyczne treści tutaj od czegoś prostego, ale żeby jednocześnie nie było to trywialne.
Opowiem wam dziś o testach jednostkowych.
Czym jest test jednostkowy?
Jak programujesz, możesz w sumie ominąć ten akapit, z definicją unitów spotykasz się nie raz.
Testy jednostkowe (eng. unit tests, pot. unit testy, unity), cyt.
"metoda testowania tworzonego oprogramowania poprzez wykonywanie testów weryfikujących poprawność działania pojedynczych elementów (jednostek) programu" (za Wikipedią).
Jednostką jest funkcja, klasa lub komponent, ogólnie najmniejsza abstrakcja, w której zachodzi jakaś czynność, którą możemy przetestować. Takie testy, aby były dobrze skonstruowane i działały na jednostkach właśnie, muszą działać według konkretnych zasad, ale o tym za chwilkę.
Dlaczego akurat zaczynam od testów?
Uwielbiam pisać unit testy, uwielbiam widzieć w projekcie dobrze napisane unit testy. Wprowadzam unity do każdego projektu w którym się znajdę, a jednocześnie bardzo nie lubię narzędzi do automatycznego mockowania - ot taka ze mnie konserwa.
I chciałabym wam opowiedzieć troszeczkę o tym, jak dobrze unity pisać.
Chciałabym przygotować serię postów dotyczących unit testów, zgodnie z poniższym planem:
0. Wprowadzenie (właśnie je czytacie).
1. Trochę słownictwa i definicji, abyśmy swobodnie mogli rozmawiać o...
2 - 6. Akronim FIRST - czyli jakich zasad powinniśmy się trzymać aby pisać dobre jakościowo (czyli użyteczne i efektywne) unit testy. Na praktycznych przykładach z użyciem frameworka jest.
7. Trochę o udawaniu czyli "mokach", "stabach" i "spajach".
8 i dalej - zobaczymy :)
Zależnie od tego, co was będzie interesować, czy wolicie backend czy frontend, możemy przejść w testy ui - snapshoty i storybook, w inne rodzaje testów...
Dajcie znać, czy pomysł na serię wam się podoba i czy w proponowanych tematach czegoś wam brakuje!
Pozdrawiam,
Wasza Kapitanka
#programowanie #programista #programming #coding #unittesting #jest #unitseries

I just finished an excellent video by "Coding Garden" on YouTube that walked me through an entire dev setup including #Vite, #ReactJS, #TypeScript, #Vitest, & #Jest
https://youtu.be/cchqeWY0Nak
Trying to use Jest and TypeScript is really frustrating. I have a Jest `expect ...` assertion that checks a value, but then I have to write a separate TS expression to narrow the type that Jest just checked.
For example, "expect(stringOrNumber).toBe('x')". At this point Jest has determined that it's a string, but TS still requires me to do "if (typeof stringOrNumber === 'string') ..."
Is there a better pattern? Or a testing library that does type narrowing?
Does anyone using #Vitest or #Jest know how to I get expect(something).to.equal(somethingElse) to play well with #TypeScript? That is, have TypeScript fail if the types don't lign up?
Spent some time today migrating from Mocha/Chai to Jest
It was both more and less miserable than I thought it would be.
I still have one specific test that’s throwing an error about not exiting after one second even though it’s set up the same as another test going to the same route. Alas that’s a problem for another day :oh_no:
One lesson I learned it to read the error messages closer because it can save a lot of time 💡
Learn why Jest breaks the `instanceof` operator
https://backend.cafe/should-you-use-jest-as-a-testing-library
#EsNextNews #EcmaScript #JavaScript #Jest
If there is someone who knows more about best and babel then me… need to bring the jest Setup back as it does not work atm with the new esbuild setup. #opensource #pipeline #neoscms #jest
Dear #jest: the color red should not occur in the output of a test run unless at least one test has failed. Using it to highlight the tests’ runtime is very confusing.
We are looking for a #JavaScript Developer at Kinsta.
As part of our JS Development Team, you will be working with some of the most exciting JavaScript tools on the market to build our client-facing and internal tools.
Our stack:
#typescript #React, #nodejs #GraphQL, #SQL, #NoSQL, #Webpack, #Babel, #SWC, #Jest, #Storybook, #GitHub, #Docker, #Stripe
Check the job opening here: https://jobs.lever.co/kinsta/02849da6-5a65-4556-ba66-74e32c16f742?lever-via=44eKAsVAXN
Handling errors from async methods in #Jest https://bit.ly/3qEgAs4
JavaScript-Testing-Framework Jest landet bei der OpenJS Foundation
@cybergrunge
Pour lancer un seul fichier de test avec #jest, tu peux lancer la commande npm run test -- src/fichier-test.spec.js
-- permet d'indiquer à npm que les arguments qui le suivent doivent être passés à la commande de test précisée dans le package.json, et non pas comme un argument destiné à npm
C'est expliqué dans le paragraphe suivant de la doc 🇫🇷 de Jest: https://jestjs.io/fr/docs/cli#utilisation-avec-les-scripts-npm
I am writing a few pure #javascript client functions and incredibly I'm enjoying it 💪 🤣
Working with #jest and pure functions is really a completely different world than piling some code frontend code
Adding unit tests when you've never done it before is very, very frustrating, but I've already caught 3 bugs, so I'm quite happy with that. 🙂
Writing #tests for Celestial 'cause I wanna do a big refactor and better my code base for the next bunch of features. And just because I want to have that clean and "this is reliable" feeling. 😉