• Stars
    star
    154
  • Rank 242,095 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Javascript assignments, tasks and katas

Brest Rolling Scopes #Brest Rolling Scopes School

Javascript Assignments Build Status

Yet another javascript assignments. There are a lot of interactive javascript resources for beginners, but most of them are online and do not cover the modern programming workflow. There are some excellent training resources on github (https://github.com/rmurphey/js-assessment, https://github.com/mrdavidlaing/javascript-koans, https://github.com/vasanthk/js-bits etc) but they are not exactly simulate the everyday programming process. So the motivation of this project is to show TDD process in the wild to the beginners. Assingment tests are implemented in various ways to feel a difference and gain the experience what manner is good, what is bad and what is ugly.

Another idea is to prepare assignment to cover all standard javascript functions, to drilling and mastering skills. Some tasks are practical, but some tasks are rather synthetic.

And the last idea is to inure trainees to work using unit test and feel uncomfortable when programming without tests.

To start javascript assignments please follow the next steps:

How to fork this repo

  • Click the Fork button at the top-right corner of this page and the repository will be copied to your own account.
  • Run git clone https://github.com/<your-account>/js-assignments.git from command line to download the repo.

How to setup travis-ci

  • Open https://travis-ci.org/ and sign in with your github account.
  • Activate your forked repo js-assignments.
  • Edit local README.md file and update all links (just replace all occurrences of 'rolling-scopes-school' with your account name).
  • Commit and push updated README.md to github:
  git add README.md
  git commit -m "Update the links"
  git push origin master

How to setup work environment

  • Download and install the latest Nodejs.
  • Run npm install from you repository folder to download the required modules. All dependent modules will be located in the node_modules folder.
  • Open your favorite editor and complete tasks.
  • Open your terminal and use npm test command to run all tests. You can run single file by passing it as argument npm test ./test/01-strings-tests.js.
  • The local repo folder has the following structure:
    node_modules - app dependences restored by npm install command, you can delete this folder and restore later again.
    task - folder with tasks modules, it's your main folder.
    test - folder with tests modules to verify the tasks completion.

How to implement assignments using TDD fashion

Now you are ready to implement assignments. Tasks modules are located in the task folder. Each module consists of several tasks for specified topic. Each task is usually a regular function:

  /**
   * Returns the result of concatenation of two strings.
   *
   * @param {string} value1
   * @param {string} value2
   * @return {string}
   *
   * @example
   *   'aa', 'bb' => 'aabb'
   *   'aa',''    => 'aa'
   *   '',  'bb'  => 'bb'
   */
  function concatenateStrings(value1, value2) {
     throw new Error('Not implemented');
  }

Resolve this task using the following TDD steps:

  • Run unit tests and make sure that everything is OK and there are no failing tests.
  • Read the task description in the comment above the function. Try to understand the idea. If you got it you are to write unit test first, but unit tests are already prepared :) Skip step with writing unit tests.
  • Remove the throwing error line from function body
     throw new Error('Not implemented');

and run the unit tests again. Find one test failed (red). Now it's time to fix it!

  • Implement the function by any way and verify your solution by running tests until the failed test become passed (green).
  • Your solution work, but now time to refactor it. Try to make your code as pretty and simple as possible keeping up the test green.
  • Once you can't improve your code and tests are passed you can commit your solution.
  • Push your updates to github server and check if tests passed on travis-ci.
  • If everything is OK you can try to resolve the next task.

How to debug tasks

To debug tests you can use Node inspector. To install it just run npm install -g node-inspector in your terminal. Then follow next steps:

  • Add debugger; to the first line of your task.
  • Run your test file with npm run test-debug ./test/01-strings-tests.js.
  • In another terminal run node-inspector and copy link from the output.
  • Open the link in your favorite browser. You should see Chrome Developers Tools like interface where you can debug your tasks.
  • When you found and fix your issue, close the browser's tab with the debug tools, stop the node-inspector by pressing Ctrl-C, stop the test runner by pressing Ctrl-C, remove the debugger; from your task.

How to debug (beginner's way)

There is an easier way to debug for beginners with free Visual Studio Code:

{
    "version": "0.2.0",
    "configurations": [
        {
           ...
           "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
           ...
           "args": ["./test/01-strings-tests.js"],
           ...
         },
         ...
     ]
}
  • Click in the gutter to the left of the line number to set the breakpoint. Press F5 to run debug.
  • NOTE: The launch.json is stored in the .vscode project folder.

##Contribution Feel free to contribute into this project. New tasks and katas are welcome.

More Repositories

1

tasks

JavaScript
3,310
star
2

lectures

422
star
3

ml-intro

RS School Machine Learning course
Jupyter Notebook
216
star
4

RSS-Teams-FE

TypeScript
173
star
5

docs

169
star
6

js-fe-course-en

JavaScript
130
star
7

stage0

HTML
77
star
8

tic-tac-toe

Tic Tac Toe game task
JavaScript
76
star
9

basic-nodejs-course

69
star
10

aws

55
star
11

stage1-tasks

50
star
12

rs.ios.lecture.material

Materials for lectures
Objective-C
50
star
13

nodejs-course-template

TypeScript
49
star
14

guessing-game

Guessing game tests
JavaScript
49
star
15

nodejs-aws-tasks

Roff
33
star
16

finite-state-machine

JavaScript
25
star
17

doubly-linked-list

Doubly linked list task
JavaScript
24
star
18

conspectuses

abstracts to the rolling scopes school lectures
21
star
19

devops

Shell
21
star
20

checklist

JavaScript
21
star
21

mentoring

20
star
22

rs.school-site

HTML
19
star
23

core-js-numbers

JavaScript
17
star
24

RS-Short-Track

17
star
25

core-js-strings

Tasks for learning methods of String class
JavaScript
16
star
26

support

15
star
27

priority-queue

Priority queue task
JavaScript
14
star
28

RS-Uzbekistan

14
star
29

sudoku

JavaScript
13
star
30

react-rslang-be

JavaScript
13
star
31

nodejs-aws-fe

TypeScript
12
star
32

react-native-course

HTML
12
star
33

file-storage

8
star
34

core-js-arrays

JavaScript
8
star
35

core-js-conditions-n-loops-tasks

JavaScript
8
star
36

core-js-objects

JavaScript
7
star
37

HTML-builder

CSS
7
star
38

clean-code-s1e1

JavaScript
5
star
39

core-js-dates

JavaScript
5
star
40

core-js-promises

JavaScript
4
star
41

core-js-functions

JavaScript
4
star
42

websockets-ui

JavaScript
4
star
43

rs.ios.stage-task12

Task12
HTML
3
star
44

rs-nodejs-be-2020Q3

TypeScript
3
star
45

movie-app-code-review

TypeScript
3
star
46

rs.android.final_task

3
star
47

ios

Task 1 for iOS School 2020Q1
3
star
48

fun-chat-server

JavaScript
2
star
49

rs.ios.final-task-requirements

Final Task Requirements
2
star
50

webpack-boilerplate

2
star
51

rs.ios.stage-task1

Task1
Objective-C
2
star
52

rs.ios.stage-task2

Task2
Objective-C
2
star
53

news-JS

JavaScript
2
star
54

travel-app-be

JavaScript
1
star
55

rs.ios.stage-task6

Task6
Swift
1
star
56

rs-nodejs-fe-2020Q3

Vue
1
star
57

rs.ios.stage-task4

Task4
Swift
1
star
58

RSS-Teams-BE

TypeScript
1
star
59

rs.ios.stage-task5

Task5
Swift
1
star