Multiple Input/Output in Node.JS

I’m trying to create input/output tests

Has anyone run tests that contain multiple inputs? I get timed out errors in all mine (trying multi line, comma separated, etc). The documentation is pretty basic and only shows basic output.

Thanks

Please share your setup! I’m sure we can figure it out together.

Hey thanks so much! I’m fairly new to teaching CS and have my kids working on javascript.

I’m trying to build the most basic test for an example:

let num1 = parseInt(prompt("Enter the first number: "));
console.log(num1);

let num2 = parseInt(prompt("Enter the second number: "));
console.log(num2);

Then a simple input/output test like so:

The test will always time out on me. It looks to be entering both inputs at once (on the 1st number input). Is there a way to separate each test input?

Have you had any luck or success with this demc? I’ve been experimenting with Jest and unit tests as well for a solution but my tests always time out waiting for input in both cases.

I know this is an old thread, but in case this helps:

With Python tests, in the expected output, I have to put everything that is output. so for my tests to work I would have to put in expected output:

Enter the first number: Enter the second number: 10 20

All on one line with spaces to seperate each line of output.

1 Like

Thanks hombre,

That all works in python (10 20) or each input on a new line in the input/output tests, but it doesn’t work for node.js for whatever reason. If you ever find a way please let us know! I’v tried to somehow push a return keystroke there but I just can’t make it work…

Hey there! We’ve been working hard on a v2 of IO testing. I’d be curious to see if the update might resolve this issue for you. Would you be open to giving it a try? If so, shoot me an email at lena@replit.com with your username and team username and I can enable the beta of the new IO testing for you!