freeCodeCamp / near-curriculum

BSD 3-Clause "New" or "Revised" License
26 stars 12 forks source link

[HELP]: The course run but basic test fails #41

Open realtebo opened 1 year ago

realtebo commented 1 year ago

Project

Learn How to Set Up NEAR by Building a Hello World Smart Contract

Lesson Number

1

Question

I opened a new bash terminal, because I have 2 terminal 'occupied' by other processes

image

Code and Screenshots

But code test cannot detect, I think, the new bash terminal.

image

This is the "Test console" output

1) You should use the change directory command (cd) in the terminal
{
  "name": "AssertionError",
  "message": "expected '\\r' to match /^\\s*cd/",
  "showDiff": false,
  "actual": "\r",
  "operator": "strictEqual",
  "stack": "AssertionError: expected '\\r' to match /^\\s*cd/\n    at eval (eval at <anonymous> (file:///workspace/near-curriculum/node_modules/@freecodecamp/freecodecamp-os/.freeCodeCamp/tooling/test.js:94:35), <anonymous>:3:8)\n    at async file:///workspace/near-curriculum/node_modules/@freecodecamp/freecodecamp-os/.freeCodeCamp/tooling/test.js:94:29\n    at async Promise.allSettled (index 0)\n    at async runTests (file:///workspace/near-curriculum/node_modules/@freecodecamp/freecodecamp-os/.freeCodeCamp/tooling/test.js:122:22)\n    at async Object.handleRunTests [as run-tests] (file:///workspace/near-curriculum/node_modules/@freecodecamp/freecodecamp-os/.freeCodeCamp/tooling/server.js:48:3)"
}
2) You should be in the learn-how-to-set-up-near-by-building-a-hello-world-smart-contract directory in your terminal
{}
moT01 commented 1 year ago

Were you ever able to get it working @realtebo?

realtebo commented 1 year ago

No, I opened course source code and simply followed tutorial without tests and any automatism.

moT01 commented 1 year ago

I thought I might have an idea of what was happening, but I can't reproduce it - so I'm not sure. Here was my thinking anyway...

For some context, what the courses do is put the terminal commands you enter into a log file - we look in that file to see what commands you enter. The error you are seeing says that you last entered \r in the terminal, which is a "carriage return".

I found this article that shows how VS Code handles end of line characters. The two options are LF (which is \n) and CRLF (which is \r\n). I thought maybe it was set to CRLF for you which was causing an extra line in the log file or something - but like I said, I can't reproduce it. It felt like I was on the right track.

Here's one possibly related thing I've seen in the past. When some people try to contribute to the relational database courses, they run the coderoad build command to build the JSON file of the course and get a whole bunch of that \r character in the file. See this commit. I don't know why that happens, but it could be related to this. Perhaps something with the OS? or terminal shell used?

gikf commented 1 year ago

Maybe log file has some more clues. Check what are the actual contents of .logs/.bash_history.log