webcontainer-core icon indicating copy to clipboard operation
webcontainer-core copied to clipboard

Running Jest or Vitest in Webcontainers doesn't exit with status 1

Open PhantomKnight287 opened this issue 1 year ago • 1 comments

Describe the bug

I installed jest in a new nodejs webcontainer and wrote a basic test that fails. I ran it using yarn jest and jest didn't exit with status 0

Link to the blitz that caused the error

https://stackblitz.com/edit/stackblitz-starters-kdtmv1?description=Starter%20project%20for%20Node.js,%20a%20JavaScript%20runtime%20built%20on%20Chrome%27s%20V8%20JavaScript%20engine&file=test.spec.ts&title=node.new%20Starter

Steps to reproduce

  • Create a new nodejs webcontainer
  • Install jest
  • Create a new test file index.spec.ts with given content
describe('It Should Work', () => {
  it("Should work",()=>{
  expect(1).toBe(2);
  })  
 });

  • Run yarn jest in terminal
  • The yarn doesn't show the error Command failed with exit code 1. instead shows Done in 2.05s

Expected behavior

It should throw status 1

Parity with Local

Screenshots

image image

Platform

Browser name  = Chrome
Full version  = 120.0.0.0
Major version = 120
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
performance.memory = {
  "totalJSHeapSize": 128021926,
  "usedJSHeapSize": 107930550,
  "jsHeapSizeLimit": 4294705152
}
Hash = 3f7046a7

Additional context

No response

PhantomKnight287 avatar Jan 23 '24 17:01 PhantomKnight287

Thanks for the report, it does seem we deviate from the expected behavior.

jrvidal avatar Jan 24 '24 20:01 jrvidal