Reputation: 21
As part of my class, we have a project folder, and within it are individual files with a matching test file. When we download, that, we have to install npm, and as we finish each problem, we run mocha to test that our answers are correct.
Throughout, I would commit after each problem was solved, and then at the end, push it to a private github repo.
Now, I'm going back through the project, and I delete my answers so I can resolve them for practice, but running mocha doesn't work. Instead of seeing the 'passing' 'failing' in the terminal, I see the the console logs up to the problem I haven't done yet, which prints a reference error indicating I haven't declared the function (because I haven't reached that problem yet.
Other than deleting the code that I wrote, I've done nothing different, yet mocha won't work. Is there something else I need to do?
Upvotes: 0
Views: 860
Reputation: 121849
You're not giving us enough information to debug precisely what Mocha's complaining about, or enough information about your project so anybody could make any informed suggestions to help you.
No matter. SUGGESTION:
You're apparently using GitHub. Cool. Consider it your own little "time machine".
Save your current work. Either "git stash" (if you're comfortable with that), or simply back up your project folder to a temp directory).
Now revert back to a previous commit.
EXAMPLE:
git log # identify previous commits. Ideally, the last commit that "worked"
git checkout xxxxxxxxx # Check out out
Rinse and repeat until you find a commit that "works".
When you're done, you might wish to do something like this:
https://stackoverflow.com/a/21718540/421195
git revert --no-commit 0766c053..HEAD git commit
This will revert everything from the HEAD back to the commit hash, meaning it will recreate that commit state in the working tree as if every commit after 0766c053 had been walked back. You can then commit the current tree, and it will create a brand new commit essentially equivalent to the commit you "reverted" to.
Git is your friend. It's useful as much more than simply a "source repository" to check in "completed code". You can also use it as a workaday tool for scenarios exactly like this.
Upvotes: 0