Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate to vitest #948

Open
wants to merge 34 commits into
base: v3
Choose a base branch
from

Conversation

caio2983
Copy link
Contributor

#947

Hello @artalar ,
Please let me know if any changes need to be done in this

Copy link

stackblitz bot commented Oct 27, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

vercel bot commented Oct 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
reatom ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 1, 2024 3:45pm

Copy link
Owner

@artalar artalar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huge work, thank you! Please, follow the comments and be ready that today I will publish a couple updates and refactoring INCLUDING the async package migration to the vitest, to there will be a small merge conflicts

Also, we use `onConnect` to fetch the list from the server every 5 seconds
and we don't want to call subscriptions extra times so we use `isDeepEqual`
in `withDataAtom` to prevent new reference stream if nothing really changed.
Also, we use onConnect to fetch the list from the server every 5 seconds
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the quotes removed?

const INTERVAL = 5

const getData = reatomAsync.from(api.getData).pipe(
// add `dataAtom` and map the effect payload into it
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the comments removed?

import { take, takeNested } from '@reatom/effects'
import { createTestCtx } from '@reatom/testing'
import { atom } from '@reatom/core'
import { mapToAsync, withDataAtom } from './index'

export const test = suite('mapToAsync')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to use describe, please change the tests runner script to this:

    "test": "vitest run src/*.test.ts",
    "test:watch": "vitest src/*.test.ts"

@caio2983
Copy link
Contributor Author

Huge work, thank you! Please, follow the comments and be ready that today I will publish a couple updates and refactoring INCLUDING the async package migration to the vitest, to there will be a small merge conflicts

Understood, I just removed that one describe usage , changed the tests runner script and fixed the comments .

Should I change the tests runner scripts to "test": "vitest run src/.test.ts",
"test:watch": "vitest src/
.test.ts" in every package besides async?

@artalar
Copy link
Owner

artalar commented Nov 1, 2024

@caio2983 ive updated the deps and the async package tests, please check

Should I change the tests runner scripts to "test": "vitest run src/.test.ts",
"test:watch": "vitest src/.test.ts" in every package besides async?

yep

@artalar
Copy link
Owner

artalar commented Jan 18, 2025

@caio2983 Hi! Sorry for the delay, I have been super busy, working, sick and many other bus factor things :) Are you interested in continuing to work on this PR? I would love to merge it as soon as possible.

@@ -1,5 +1,4 @@
import { test } from 'uvu'
import * as assert from 'uvu/assert'
import { describe, it, expect } from 'vitest'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, you can set up a global: true in vitest.config and this will allow you to remove all imports from 'vitest'

https://vitest.dev/config/#globals

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imho direct import is more obvious.

@AgarkovRoman
Copy link
Contributor

consider to use a workspace feature in vitest which can be useful for monorepo such as reatom

@AgarkovRoman
Copy link
Contributor

@artalar I can take over this and continue migration, do you mind?

@artalar
Copy link
Owner

artalar commented Jan 24, 2025

@AgarkovRoman ok, go ahead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants