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

Allow to plan tests with todo flag #563

Closed
mateusjbarbosa opened this issue Jul 20, 2024 · 9 comments · Fixed by #633
Closed

Allow to plan tests with todo flag #563

mateusjbarbosa opened this issue Jul 20, 2024 · 9 comments · Fixed by #633

Comments

@mateusjbarbosa
Copy link

mateusjbarbosa commented Jul 20, 2024

Hi, everyone!

First, congratulations on the initiative! I’m using Poku in a new project and I’m loving it.

One thing I used in Jest and believe I can add here is also the possibility of planning tests before developing them, using the todo flag or method, as the example below.

test.todo('ensure that is possible sum two numbers')
  • Propused Poku format
import { describe, test, it } from 'poku'

describe('Using todo', () => {
  test.todo('ensure that is possible sum two numbers')
  // or
  it.todo('ensure that is possible sum two numbers')
})

If I may, I can try to develop and open a PR. I would love to be part of the project!

@mateusjbarbosa mateusjbarbosa changed the title Allow to plan tests with todo flag or method Allow to plan tests with todo Jul 20, 2024
@mateusjbarbosa mateusjbarbosa changed the title Allow to plan tests with todo Allow to plan tests with todo flag Jul 20, 2024
@wellwelwel
Copy link
Owner

wellwelwel commented Jul 20, 2024

Thanks, @mateusjbarbosa 🤝

Can you show a visual reference of what the terminal output would look like?


For example, the skip visual:

Screenshot 2024-07-20 at 07 15 51 Screenshot 2024-07-20 at 07 16 40

As I've never used this method before, in my mind it would sound similar.

@wellwelwel
Copy link
Owner

wellwelwel commented Jul 20, 2024

I'm wondering about the current complexity of test / it modules

export async function test(
message: string,
cb: () => Promise<unknown>
): Promise<void>;
export async function test(message: string, cb: () => unknown): Promise<void>;
export async function test(cb: () => Promise<unknown>): Promise<void>;
export function test(cb: () => unknown): void;


What do you think about this approach?

import { describe, it, todo } from 'poku'

describe('Using todo', () => {
  todo('ensure that is possible sum two numbers');

  it('real test', () => true)
})

todo('ensure that is possible sum two numbers')

@mateusjbarbosa
Copy link
Author

Thanks, @mateusjbarbosa 🤝

Can you show a visual reference of what the terminal output would look like?

For example, the skip visual:

Screenshot 2024-07-20 at 07 15 51 Screenshot 2024-07-20 at 07 16 40

As I've never used this method before, in my mind it would sound similar.

Of course, @wellwelwel !

I think it could be something like this:

Directory: <dir>

<file>.test.ts
    ✔︎ passed test description
    ✘ failed test description
    ❍ planned test description (yellow or orange)
✔ 1/3 <cmd><time>

Start at › <start>
Duration › <duration>
Test Files › <files count>

PASS › 1 PLANNED › 1 (same color) FAIL › 1

Of course we can think of a better icon for the planned test, it was just an example.

@mateusjbarbosa
Copy link
Author

I'm wondering about the current complexity of test / it modules

export async function test(
message: string,
cb: () => Promise<unknown>
): Promise<void>;
export async function test(message: string, cb: () => unknown): Promise<void>;
export async function test(cb: () => Promise<unknown>): Promise<void>;
export function test(cb: () => unknown): void;

What do you think about this approach?

import { describe, it, todo } from 'poku'

describe('Using todo', () => {
  todo('ensure that is possible sum two numbers');

  it('real test', () => true)
})

todo('ensure that is possible sum two numbers')

It's perfect!

@mrazauskas
Copy link
Contributor

mrazauskas commented Jul 20, 2024

To be honest, I just wanted to open an issue asking for .fail, .only, .skip, .todo modifiers. Not so important how that would be designed. What is important:

  • it must be possible to set any of the modifiers for any describe(), test() or it()
  • also a single assertion can be skipped or focused (that’s optional)

Motivation is very simple. If tests are well organised, while debugging / developing certain behaviour user might want to skip or focus the whole file, the whole describe() or test() and even a single assert() (note that test() is not required in Poku). Why not? ;D

@wellwelwel
Copy link
Owner

wellwelwel commented Jul 20, 2024

(note that test() is not required in Poku). Why not? ;D

In theory, even assertions aren't necessary, it's enough for the process to end in success.
My idea in creating Poku was to have a really modular tester that I could build my own style of testing.

  • Please feel free to request features, report bugs and even discuss ideias for PRs (I'd love that) 🙋🏻‍♂️

@wellwelwel
Copy link
Owner

wellwelwel commented Aug 1, 2024

Hey @mateusjbarbosa, it was solved in #633 and will be released in the next version 🙋🏻‍♂️

Similar to the .skip method from other testers, .todo also accepts callbacks which will be ignored for future elaborations or prototype implementations (this isn't a replacement for the future .skip method).

For more details, please see https://poku.io/docs/documentation/helpers/todo.

Now that all the bug labels have been fixed, I'm happy to be able closing the first feature request 🎉

@mateusjbarbosa
Copy link
Author

Once again, thank you for your attention and congratulations on the work! 🚀

@wellwelwel
Copy link
Owner

Once again, thank you for your attention and congratulations on the work! 🚀

Thanks for your support, @mateusjbarbosa 💙

Already released in v2.3.0 🙋🏻‍♂️

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

Successfully merging a pull request may close this issue.

3 participants