Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.

Commit 0d1f5d5

Browse files
author
Dedekind561
committed
update package.json to be consistent with js1 week 1
1 parent eb4ae8d commit 0d1f5d5

File tree

1 file changed

+45
-9
lines changed

1 file changed

+45
-9
lines changed

README.md

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,51 @@
1-
Like learning a musical instrument, programming requires daily practise.
1+
# Coursework
22

3-
The exercises are split into three folders: `exercises`, `mandatory` and `extra`. All homework in the `exercise` and `mandatory` section **must** be completed for homework by the following lesson.
3+
Like learning a musical instrument, programming requires daily practice.
4+
5+
The exercises are split into two folders: `mandatory` and `extra`. All homework in the `mandatory` section **must** be completed for homework by the following lesson.
46

57
The `extra` folder contains exercises that you can complete to challenge yourself, but are not required for the following lesson.
68

9+
If you think you need to do more practice with the basics, then you can find some more exercises listed in `resources.md`. These exercises are not mandatory and won't be assigned as part of your coursework for the week.
10+
11+
## Setting up your code editor
12+
13+
14+
There are some tools that will help you to write code. One of these, [Prettier](https://prettier.io/), formats your code, making it easier for you and others to read.
15+
16+
### 1. Install prettier
17+
18+
- In Visual Studio open the extensions panel (see https://code.visualstudio.com/docs/editor/extension-gallery#_browse-and-install-extensions)
19+
- Search for `Prettier - Code formatter`
20+
- Click install on the top result
21+
22+
### 2. Enable formatting on save
23+
24+
- In Visual Studio open the settings file (see https://code.visualstudio.com/docs/getstarted/settings#_creating-user-and-workspace-settings)
25+
- Search for `editor format`
26+
- Set `editor.formatOnSave` and `editor.formatOnPaste` to true
27+
28+
29+
## Running the code/tests
30+
31+
The files for the mandatory/extra exercises are intended to be run as jest tests.
32+
33+
- Once you have cloned the repository, run `npm install` once in the terminal to install jest (and any necessary dependencies).
34+
- To run the tests for all mandatory/extra exercises, run `npm test`
35+
- To run only the tests for the mandatory exercises, run `npm test -- --selectProjects mandatory`
36+
- To run only the tests for the extra exercises, run `npm test -- --selectProjects extra`
37+
- To run a single exercise/test (for example `mandatory/1-writer.js`), run `npm test -- --testPathPattern mandatory/1-writer.js` (Remember, you can use tab-completion to get files relative to the current directory, so m`Tab ↹`/1-`Tab ↹` will autocomplete get you the test file starting with 1-)
38+
39+
For more information about tests, look here:
40+
41+
https://syllabus.codeyourfuture.io/guides/intro-to-tests
42+
43+
Try out variant way of running tests:
44+
45+
- `npm test` -> run all mandatory and extra tests
46+
- `npm test -- --selectProjects mandatory` -> run only mandatory tests
47+
- `npm test -- --testPathPattern mandatory/1-syntax-errors.js` -> run single test
48+
749
## Solutions
850

951
The solutions for this coursework can be found here:
@@ -12,15 +54,9 @@ https://github.com/CodeYourFuture/JavaScript-Core-1-Coursework-Week2-Solution
1254

1355
This is a **private** repository. Please request access from your Teachers, Buddy or City Coordinator after the start of your next lesson.
1456

15-
## Testing your work
16-
17-
- Each of the *.js files in the `exercises` folder can be run from the terminal using the `node` command with the path to the file. For example, `node exercises/B-boolean-literals/exercise.js` can be run from the root of the project.
18-
- To run the tests in the `mandatory` folder, run `npm run test` from the root of the project (after having run `npm install` once before).
19-
- To run the tests in the `extra` folder, run `npm run extra-tests` from the root of the project (after having run `npm install` once before).
20-
2157
## Instructions for submission
2258

23-
For your homework, we'll be using [**test driven development**](https://medium.com/@adityaalifnugraha/test-driven-development-tdd-in-a-nutshell-b9e05dfe8adb) to check your answers. Test driven development (or TDD) is the practice of writing tests for your code first, and then write your code to pass those tests. This is a very useful way of writing good quality code and is used in a lot of industries. You don't have to worry about knowing how this works, but if you're curious, engage with a volunteer to find out more! :)
59+
For your homework, we'll be using tests to check your answers. The tests will assert that your functions behave in the correct way. A **failing test** ❌ indicates that a function _is not_ behaving correctly; a **passing test** ✅ indicates that your function is behaving correctly.
2460

2561
1. Complete the challenges in each file and save it once you're happy with your changes
2662
2. Run the script to check the results against the tests - all tests should read PASSED if you completed the challenges correctly. If a test reads FAILED, find the associated test to identify which function failed and fix it.

0 commit comments

Comments
 (0)