We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am trying to run jest test but it is not even starting. I am trying the reason behind at least a log why it did not run.
here is my code:
import { Box } from "@chakra-ui/react"; import { useContext, useEffect, useRef } from "react"; import { FileSystemContext } from "@/contexts/FileSystem"; const TestRunner = () => { const { visibleFiles } = useContext(FileSystemContext); const iFrame = useRef<HTMLIFrameElement>(null); const startEmulator = async () => { if (iFrame.current) { const { Nodebox } = await import("@codesandbox/nodebox"); const emulator = new Nodebox({ iframe: iFrame.current, }); await emulator.connect(); await emulator.fs.init({ "package.json": JSON.stringify({ name: "my-app", scripts: { test: "jest", }, dependencies: { // jest: "29.5.0", "@testing-library/jest-dom": "5.16.5", }, }), "test.test.js": ` import { readFileSync } from "fs"; import '@testing-library/jest-dom/extend-expect'; describe('index.html', () => { let content; beforeEach(() => { content = readFileSync("./index.html",'utf8'); document.documentElement.innerHTML = content; }); it('contains h1 tag', () => { expect(document.querySelector("h1")).not.toBeNull(); }); it('h1 tag has text Murad', () => { expect(document.querySelector("h1").innerHTML).toEqual("Murad"); }); it('has to have a style', () => { expect(document.querySelector('h1')).toHaveStyle({ backgroundColor: 'red', fontSize: '16px', }); }); });`, "index.html": `<html> <head> <title>first</title> <style> h1 { background-color: red; font-size: 16px; } </style> </head> <body> <h1>Murad</h1> </body> </html>`, }); const shell = emulator.shell.create(); shell.on("progress", (status) => console.log(status)); shell.stderr.on("data", (data) => { console.log("Error:", data); }); shell.stdout.on("data", (data) => { console.log("Output:", data); }); shell.on("exit", (status) => console.log(status)); const serverCommand = await shell.runCommand("npm", ["run", "test"]); console.log(serverCommand); } }; useEffect(() => { startEmulator(); }, []); return ( <Box> <iframe ref={iFrame}></iframe> </Box> ); }; export default TestRunner;
and log: basicaly it downloads the packages and quits
The text was updated successfully, but these errors were encountered:
any comments?
Sorry, something went wrong.
Did you manage to fix it? Currently facing similar issue
Unfortunately no. I used webcontainer by stackblitz. repo: https://github.com/stackblitz/webcontainer-core
Please discuss using webcontainers for jest in the webcontainers repo, this isn't really the place to do that
No branches or pull requests
I am trying to run jest test but it is not even starting. I am trying the reason behind at least a log why it did not run.
here is my code:
and log:
![image](https://private-user-images.githubusercontent.com/90407083/239820929-69b9a036-40a3-488d-acb1-27a7c59020e2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2ODc4MDAsIm5iZiI6MTcxOTY4NzUwMCwicGF0aCI6Ii85MDQwNzA4My8yMzk4MjA5MjktNjliOWEwMzYtNDBhMy00ODhkLWFjYjEtMjdhN2M1OTAyMGUyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI5VDE4NTgyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFjMmU1MmFiNGVjNzg1NDVkOWU0OTQxOGY4YzcwYTVkYjA4MzM4MDEzZGYzMzljOTNiMWFhNjNmOWE0YTkzMzMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.gkwurB_4Od74hP8MWPE7vDhz_Et018iuPEak4-NeWoU)
basicaly it downloads the packages and quits
The text was updated successfully, but these errors were encountered: