Pomodoro Test Suite Missing And Error: "#Mocha" Div Missing so I can't test my pomodoro clock : (

The “Test Suite” is open as soon as I view my Pomodoro Clock Codepen which it wasn’t doing before.
I looked at the “Test Suite” and the “Pomodoro Test” isn’t there, but other test are.
I also see an error displayed: “#mocha” div missing

Here’s my codepen if you want to check it out: https://codepen.io/nwbnwb/pen/VwaWvPR?editors=0010

As an FYI, the test suite was recently updated to reflect the new project name. You’ll want to run the 25 + 5 clock tests. :slight_smile:

Okay.
Why did they change the name?
Did they change in the challenge requirements?

The changes on the /learn platform are in the works, but have not been deployed yet AFAIK.

what does AFAIK mean?

“As far as I know” :slight_smile:

I ran the test, it says I pass all but one. I’m getting a TypeError: property 1 of null. It passes the session countdown test but not the break countdown test because it says the value should be the value that’s in session-length, but the value in session length is the same as the value in my variable sessionLength. I’m not for sure what’s going on.

I posted a new topic about this. I tried some things and I believe it may be an error in test suite. The new post explains why. If you want to read it, I’ll give you the link to it if you want.

I’m passing all the test for the Pomodoro Clock’s (25 +5) test suite even though my clock is working well.

I clicked “debugger mode” in my Codepen, and then I opened the console and it doesn’t show any errors even when I’m running it or doing different things with it.

I found out the error is happening at the setSessionTimer part of the code below, specifically, the sessionLength variable/value of the minutes key/property:

      if (sessionTimer.minutes == 0 && sessionTimer.seconds == 0) {
                // beep.play();
                setSessionTimer(prev => ({minutes: sessionLength, seconds: "00"}));
                console.log("Session Timer Error Point", sessionTimer.minutes, sessionTimer.seconds, sessionLength, SessionLength, {minutes: sessionLength, seconds: "00"});
                
                setTimerLabel("Break Timer");
              }

I placed a console.log after the point of where the error is happening to test the variable, but the variable is longing, so maybe it’s a bug in the test suite or something else I have no clue of.

Here’s the console.log:
console.log(“Session Timer Error Point”, sessionTimer.minutes, sessionTimer.seconds, sessionLength, SessionLength, {minutes: sessionLength, seconds: “00”});

Here’s the error:
“TypeError: Cannot read property ‘1’ of null”

Here’s my codepen if you would like to check it out:

Please help. I would like to submit my work to FCC and move on to the next curriculum challenge or learning material.

Hello there,

Please edit your post title to be much shorter. Any extra information not needed to define the topic should go in the body of your post.


Something to have a look at would be this error output I see in the dev console:

Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause(). DOMException - The play() request was interrupted - Chrome for Developers

It appears this error is what is causing the tests to error out.

Hope this helps

I went ahead and combined your posts for you. Seeing as this is the same question about the same project, we try to keep the forum neat, by reducing the number of topics.


If you do happen to find an issue with the test-suite, then opening up a topic explaining what the issue is in #contributors, or opening an issue on GitHub would be best.

Cheers

Are you sure that the pause is what’s causing “TypeError: Cannot read property ‘1’ of null”?

I politely ask because
I commented out the beep.pause() in my resetAll() function
and I still get “TypeError: Cannot read property ‘1’ of null”

I also commented out the useLayoutEffect function contianing my beepAlarm function.

And that test is still not passing.

But “#Mocha” Div Missing isn’ t the problem anymore.

I’m getting “TypeError: Cannot read property ‘1’ of null”;

The test suite is returning:

  1. When a break countdown reaches zero (NOTE: timer MUST reach 00:00), a new session countdown should begin, counting down from the value currently displayed in the id=“session-length” element.

Cannot read property ‘1’ of null
TypeError: Cannot read property ‘1’ of null

I think they are related, because as this error appears, the tests immediately fail and error out. So, no, unfortunately, I am not sure.

But I’m not getting the mocha or that other error anymore. That error was being caused by a button that I created to test to play the audio which I commented out. And that’s why I created a new post because it seemed to be a different issue.

And I politely ask, if you’re not sure, why would you merge the two post I created together?

You may open a new topic about the same project, if the first topic was requesting help, and the second is asking for feedback (Code Feedback). Otherwise, it is best to continue the discussion on the same thread.

But, as I noted in one of the previous comments, it appears to be a whole other issue. I commented out all the code related to pause, play, as well as the entire useLayoutEffect, but #15 of test suite is still not passing.

When I console.log the sessionLength after where the error seems to be occurring, it is yielding a value and is not null.

This error likely comes from this function in the tests:

const timerRe = new RegExp(/^(\d{2,4})[\.:,\/](\d{2})$/);

function getMinutes(str) {
  return timerRe.exec(str)[1];
}
const currentTime = +getMinutes(
  document.getElementById('time-left').innerText
);

Have a go at debugging why the regex might not be matching your returned value.

When I tested it, you timer goes to 1:00 for 1 second, when switching from Session to Break.

Hope this helps

Thank you for doing your best to help me.

I don’t know a lot about debugging so I’m not very good at it, so I have to ask, how would I use that?
Would I just copy and paste that in the console after opening the Codepen debugging view? and then put in my the variable sessionLength to see what it returns?

The other thing is that my code pass the 13th test using a similar code structure: When a session countdown reaches zero (NOTE: timer MUST reach 00:00), a new break countdown should begin, counting down from the value currently displayed in the id=“break-length” element.1951ms
The other thing is that the
so it should be passing the other test too.