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

Only one describe block per module #5

Open
BorePlusPlus opened this issue Mar 8, 2023 · 1 comment
Open

Only one describe block per module #5

BorePlusPlus opened this issue Mar 8, 2023 · 1 comment

Comments

@BorePlusPlus
Copy link

It seems that zUnit only runs the first test suite (aka describe block) in a module and ignores subsequent ones.

const { describe, it } = require("zunit");

describe("first", () => {
  it("tests");
});

describe("second", () => {
  it("tests");
});

gives following output when run

$ npx zunit

bar

  first
    tests 
     - SKIPPED: Pending (0ms)

Summary
  Tests: 1, Passed: 0, Failed: 0, Skipped: 1, Duration: 7ms

One or more tests were not run!

as a contrast mocha will run both

describe("first", () => {
  it("tests");
});

describe("second", () => {
  it("tests");
});

output

npx mocha                                                                                                                                                                 
                                                                                                         
                                                                                                         
  first                                                                                                  
    - tests                                  
                                                    
  second                                                                                                 
    - tests              
                                                    
                                                                                                         
  0 passing (2ms)                                   
  2 pending

Is this behaviour as designed or a bug? If it is deliberate, I would love to learn why.

Cheers

@cressie176
Copy link
Member

Sorry for the delay @BorePlusPlus. It's deliberate. The reason was the way I original implemented zUnit to automatically add the suite to the modules default export. This broke with ESM so I have since re-implemented. I suspect it may be possible now.

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

No branches or pull requests

2 participants