diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..46c150e1 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,36 @@ + + +**Volunteers: Are you marking this coursework?** _You can find a guide on how to mark this coursework in `HOW_TO_MARK.md` in the root of this repository_ + +# Your Details + +- Your Name: +- Your City: +- Your Slack Name: + +# Homework Details + +- Module: +- Week: + +# Notes + +- What did you find easy? + +- What did you find hard? + +- What do you still not understand? + +- Any other notes? diff --git a/.github/workflows/close.yml b/.github/workflows/close.yml new file mode 100644 index 00000000..137dc57e --- /dev/null +++ b/.github/workflows/close.yml @@ -0,0 +1,17 @@ +name: "Close stale issues and PRs" +on: + workflow_dispatch: + schedule: + - cron: "30 1 * * *" + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v3 + with: + stale-pr-message: "Your coursework submission has been closed because nobody has interacted with it in six weeks. You are welcome to re-open it to get more feedback." + days-before-stale: 42 + days-before-close: 0 + days-before-issue-stale: -1 + days-before-issue-close: -1 diff --git a/.github/workflows/extra-tests.yml b/.github/workflows/extra-tests.yml new file mode 100644 index 00000000..98afebb4 --- /dev/null +++ b/.github/workflows/extra-tests.yml @@ -0,0 +1,14 @@ +name: Run extra tests +on: + pull_request: + paths: + - 3-extra/** +jobs: + extra-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install modules + run: npm install + - name: Run extra tests + run: npm test -- --selectProjects extra diff --git a/.github/workflows/mandatory-tests.yml b/.github/workflows/mandatory-tests.yml new file mode 100644 index 00000000..b588bae5 --- /dev/null +++ b/.github/workflows/mandatory-tests.yml @@ -0,0 +1,11 @@ +name: Run mandatory tests +on: pull_request +jobs: + mandatory-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install modules + run: npm install + - name: Run mandatory tests + run: npm test -- --selectProjects mandatory diff --git a/README.md b/README.md index 1ca17aae..1ac1de8d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ Like learning a musical instrument, programming requires daily practise. -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. +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. The `extra` folder contains exercises that you can complete to challenge yourself, but are not required for the following lesson. @@ -13,11 +13,26 @@ https://github.com/CodeYourFuture/JavaScript-Core-1-Coursework-Week3-Solution This is a **private** repository. Please request access from your Teachers, Buddy or City Coordinator after the start of your next lesson. -## Testing your work +## Running the code/tests + +The files for the mandatory/extra exercises are intended to be run as jest tests. + +- Once you have cloned the repository, run `npm install` once in the terminal to install jest (and any necessary dependencies). +- To run the tests for all mandatory/extra exercises, run `npm test` +- To run only the tests for the mandatory exercises, run `npm test -- --selectProjects mandatory` +- To run only the tests for the extra exercises, run `npm test -- --selectProjects extra` +- To run a single exercise/test (for example `2-mandatory/1-weather-report.js`), run `npm test -- --testPathPattern 2-mandatory/1-weather-report.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-) + +For more information about tests, look here: + +https://syllabus.codeyourfuture.io/guides/intro-to-tests + +Try out variant way of running tests: + +- `npm test` -> run all mandatory and extra tests +- `npm test -- --selectProjects mandatory` -> run only mandatory tests +- `npm test -- --testPathPattern 2-mandatory/1-weather-report.js` -> run single test -- Each of the *.js files in the `1-exercises` folder can be run from the terminal using the `node` command with the path to the file. For example, `node 1-exercises/A-undefined/exercise.js` can be run from the root of the project. -- To run the tests in the `2-mandatory` folder, run `npm run test` from the root of the project (after having run `npm install` once before). -- To run the tests in the `3-extra` folder, run `npm run extra-tests` from the root of the project (after having run `npm install` once before). ## Instructions for submission diff --git a/package.json b/package.json index dc4e9ace..a5353545 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,7 @@ "description": "Exercises for JS1 Week 3", "license": "CC-BY-SA-4.0", "scripts": { - "test": "jest --testRegex='mandatory[/\\\\].*\\.js$'", - "extra-tests": "jest --testRegex='extra[/\\\\].*\\.js$'" + "test": "jest" }, "repository": { "type": "git", @@ -15,11 +14,25 @@ "url": "https://github.com/CodeYourFuture/JavaScript-Core-1-Coursework-Week3/issues" }, "jest": { - "reporters": [ - "default", - "/util/github-action-reporter.js" - ] - }, + "projects": [ + { + "displayName": "mandatory", + "testMatch": [ + "/2-mandatory/*.js" + ] + }, + { + "displayName": "extra", + "testMatch": [ + "/3-extra/*.js" + ] + } + ], + "reporters": [ + "default", + "/util/github-action-reporter.js" + ] + }, "homepage": "https://github.com/CodeYourFuture/JavaScript-Core-1-Coursework-Week3#readme", "devDependencies": { "jest": "^26.6.3"