Masthash

#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

John :dotnet: :csharp:
1 week ago

Fixed another major issue with my #jest tests where it was including the #NgRx modules, and throwing errors. Now only 22 failing tests out of 176. #Angular.

John :dotnet: :csharp:
1 week ago

I've managed to get the #Jest tests running, though about half are now having issues with paths and not finding modules.

John :dotnet: :csharp:
2 weeks ago

Back on my #Angular project, fixed an issue with the routing. Now, having an issue with running #Jest tests: Cannot find module '@angular/core/testing' from 'node_modules/jest-preset-angular/build/setup-jest.js'

susomejias
2 weeks ago

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/

#testing #jest #ci #shards

Chris Minnick
3 weeks ago

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?

Alex LaFroscia
3 weeks ago

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!

Damian Thater
3 weeks ago

#Jenkins verrichtet seinen #CICD Dienst auf dem neuen alten i5 anstandslos und sogar recht zügig. Kein Wunder, die App ist noch winzig. Sie hat gerade einmal einen einzigen #Jest #UnitTest. Immerhin ist dieser grün. 😅

Christian
1 month ago

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.

Tom Jowitt
1 month ago

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.

Doug Parker
1 month ago

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.
* ...

TechnoTim
1 month ago

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

Dave Mackey
2 months ago

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 😉

https://github.com/davidshq/next-search

Doug Parker
2 months ago

@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

JBRoss
2 months ago

"If ignorance is bliss, why aren't there more happy people in the world?" — Stephen Fry — — — #StephenFry #quote #quotes #quip #snarky #bliss #ignorance #humor #humorous #funny #jest #truth #joke

Tim Van Dijck
2 months ago

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

ng-news
2 months ago

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

Episode 23/04
Alex LaFroscia
2 months ago

Does anyone have experience with testing out the performance impact of a #Jest to #Vitest migration? After hearing about Vitest being significantly slower, I’m trying to gauge how to tell if we’ll run into that trouble before migrating the entire, complicated test suite over

Tim Van Dijck
2 months ago

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

Steve Fenton ♾️
3 months ago

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/

Andy Balaam
3 months ago

TIL that if you get a weird error from your Jest tests about document being null, check for an infinite loop of useEffect or useCallback due to one of the use* dependencies being always-changed.

#react #jest

bitExpert AG
3 months ago

Handling errors from async methods in #Jest https://bit.ly/3UNZHbK #bitBlog

Queen of New York
3 months ago

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.

Queen of New York
3 months ago

< 4.5 working days left for me this year. My weekend of terrible sleep has me falling asleep at my desk while trying to follow a #React tutorial. Will I have more luck trying to get #Jest to work in our docker-compose environment so we can finally have unit tests? Probably not. Zzzzzz.

gervais_b
3 months ago

I discovered that #jest can produce a JUnit report. This report is understood by #GitLab that allows you to browse the result form GitLab itself, without walking trough the logs.

https://about.gitlab.com/blog/2022/11/01/how-to-automate-testing-for-a-react-application-with-gitlab/

Jules Sagot
4 months ago

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

#veille

Stephan Hochdörfer
4 months ago

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

#react #nextjs #reactQuery #vitest #jest #typescript

katerberg
4 months ago

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.

https://jestjs.io/

#jest #testing #libraries #DevEx #UnitTest

Dan Dean
4 months ago

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.

CaptainMoonlady
4 months ago

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

Vince Aggrippino 🇺🇸🇲🇾
4 months ago

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

Marc
4 months ago

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?

#TypeScript #Jest

Bart Louwers
4 months ago

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?

Mitchell Mudd
4 months ago

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 💡

#javascript #testing #jest #learning

Markus Günther
4 months ago

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

kechpaja
4 months ago

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

Stephan Hochdörfer
5 months ago

Handling errors from async methods in #Jest https://bit.ly/3qEgAs4

Stephan Hochdörfer
6 months ago
Stephan Hochdörfer
7 months ago
Die Verantwortung für eins der populärsten Testwerkzeuge für JavaScript wandert von Meta zu der unter dem Dach der Linux Foundation geführten OpenJS Foundation.
JavaScript-Testing-Framework Jest landet bei der OpenJS Foundation
Jules Sagot
1 year ago

@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

Ru
3 years ago

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. 🙂

#jest #javascript

Ru
3 years ago

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. 😉

#jest #javascript

Robert Koch
4 years ago

@hugo no just thinking about blogging, some #jest mocking I did, gotta get my blogging hat on

A-tak
4 years ago

jestでやっとVuexのStoreをスタブと置き換える所まではできてるっぽいが、スタブから値がうまく返せない。常にundefined。
おしい。
#タスク管理ツール #jest