Curriculum tests

So I decided to try and start contributing to the open source project, I’ve cloned the repository, configured everything, wrote my first line of code and ran npm run test --block=basic-javascript. The tests themselves, along with the test suits and snapshots passed, but I got some errors and don’t know if I should be concerned about them:

Test Suites: 98 passed, 98 total
Tests:       652 passed, 652 total
Snapshots:   30 passed, 30 total
Time:        10.789 s, estimated 14 s
Ran all test suites.

> @freecodecamp/freecodecamp@0.0.1 test:curriculum
> cd ./curriculum && npm test


> @freecodecamp/curriculum@0.0.0-next.4 test
> mocha --delay --exit --reporter progress --bail

Uncaught exception: Failed to launch the browser process!
/home/tarabryn/open_source_contributions/freeCodeCamp/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory


TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

Error: Failed to launch the browser process!
/home/tarabryn/open_source_contributions/freeCodeCamp/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory


TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

    at onClose (/home/tarabryn/open_source_contributions/freeCodeCamp/node_modules/puppeteer/src/node/BrowserRunner.ts:223:9)
    at Interface.<anonymous> (/home/tarabryn/open_source_contributions/freeCodeCamp/node_modules/puppeteer/src/node/BrowserRunner.ts:209:50)
    at Interface.emit (node:events:532:35)
    at Interface.close (node:readline:586:8)
    at Socket.onend (node:readline:277:10)
    at Socket.emit (node:events:532:35)
    at endReadableNT (node:internal/streams/readable:1346:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! Lifecycle script `test` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: @freecodecamp/curriculum@0.0.0-next.4 
npm ERR!   at location: /home/tarabryn/open_source_contributions/freeCodeCamp/curriculum 
ERROR: "test:curriculum" exited with 1.

Hello there,

It looks like you are in the root directory when you ran that command.

If so, you can run the tests for a specific block from root, but you will need to use:

npm run test:curriculum --block='Basic JavaScript'

That error can come about for two reasons:

  1. You do not have the necessary dependencies installed to use puppeteer
  2. You do not have freeCodeCamp running locally in another terminal. That is, this is how I would run the tests:

a) Terminal 1: Start MongoDB

mongod

b) Terminal 2: Install deps

npm ci

c) Terminal 2: Seed the DB

npm run seed

d) Terminal 2: Start the server

npm run develop:server

e) Terminal 3: Start the client

npm run develop:client

f) Terminal 4: Run the tests

npm run test:curriculum --block='Basic JavaScript'

Hope this helps

Hello, I already have MongoDB running in docker. I’m assuming I only need to seed it once correct? I seeded it before starting so I could test the code in the browser.

There are two differences betweem what you put here and what I did:

  1. instead of using npm run develop:server and npm run develop:client I just ran the one line npm run develop.
  2. instead of using --block="Basic Javascript" I used --block=basic-javascript.

I tried running it as you suggested and got the same error.

If you got the same error, I suggest you run npm run cypress:install-build-tools, and watch the terminal.

2 Likes

that worked, thanks! One of the tests is failing, but I’ll create a new thread for that as it’s a separate issue.

1 Like

I’ve been contributing on gitpod and I’ve been needing to run npm run cypress:install-build-tools before i can run tests using npm run test:curriculum.

Is this something that can be automated using gitpod.yml?

Welcome there,

Yes. We did look into this.

The reason we did not do this is it made the startup take ~6min longer, which is not worth it when most are not running the tests.

Ah okay. I couldn’t find this mentioned anywhere in contribute docs and came to this forum post.

Unfortunately, we just have a lot of docs, now :sweat_smile:

:grimacing: Are there any plans to refactor the already existing docs?

I feel like it would be really great for new contributors like me :sweat_smile:

Moving this to Contributing guide for gitpod contributors as it is more relevant of a topic there

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.