“This article has participated in the call for good writing activities, click to view: the back end, the big front end double track submission, 20,000 yuan prize pool waiting for you to challenge!”

The task list

  • Task 1: Be a qualified code contributor
    • How do I download the code?
    • How do I run the code?
    • How to submit code contributions to Build wheels everyday?
  • Task 2: Write a TDD compliant code
  • How to develop a Helloworld using TDD(test-driven)?

Recently, Uncle Ran’s “Make wheels every day” program has been welcomed by everyone, but many people eat melons, but few people really join in.

In order not to be one of those Chinese fans who only watch football, but don’t play.

Uncle Ran specially to play you brought, every day to make wheels new village task

Task 1: Be a qualified code contributor

Download and submit the code

First of all, how to download and submit code is a git-related operation.

The fork the code

Log in making

Github.com/su37josephx…

Clone code

Then you can download your code on your Github.

Su37josephxia /wheel-awesome

Su37josephxia /wheel-awesome

Su37josephxia /wheel-awesome

git clone [email protected]:youname/wheel-awesome.git
Copy the code

Synchronizing the latest code

First of all, the reason why you do this is because while you’re developing, other people are doing it, and it’s very likely that you’re forking code that’s not up to date, you need to update your code at least once before you push it so that it doesn’t conflict with the main repository code.

So let’s first create a new Origin

Add a new remote branch

This only needs to be done once

git remote add upstream [email protected]:su37josephxia/wheel-awesome.git
Copy the code

Pull merge remote branch to master branch

This needs to be done at all times to keep your master branch officially up to date.

Git merge upstream/masterCopy the code

Write the code

We’ll do a basic code update exercise for later chapters on how to work with new code. As an exercise, you can update your name to the genius list.

Commit code

git add .
git commit -am 'add ranshu to helloworld '
Copy the code

Push the code

git push
Copy the code

Submit PullRequest to build wheels project

Then wait uncle give you commit, the following uncle my action, you did not have a look there on the line

Task 2: Write a TDD compliant code

Open source code, automatic test standard. Mainly used for regression testing. For example, if you submit a line of code, the code manager needs to analyze its impact on previous functionality in the shortest possible time. The most effective way to do this is to run through previously written test cases.

In turn, your code must be tested by automated cases.

Run and test the code

Install dependencies

Run the test case

Write the Helloworld code

module.exports = (callback) = > {
    callback && callback('hi')
    return 'hello world'
}
Copy the code

Write test cases

describe("Helloworld".() = > {
  test("Return parameters correct".() = > {
    const hello = require(".. /index");

    const fn = jest.fn();
    hello();
    expect(hello(fn)).toBe("hello world");
  });

  test("The callback function is called correctly".() = > {
    const hello = require(".. /index");

    const fn = jest.fn();
    hello(fn);

    const calls = fn.mock.calls;
    expect(calls.length).toBe(1);
    expect(calls[0] [0]).toBe("hi");
  });
});

Copy the code

The articles

[Vue3 official tutorial] 🎄 word notes | synchronous learning video guide

[Vue official tutorial notes]- Yu Xi handwritten mini-vue

How to join open Source projects – How to PR Vue3.0

I did animation all night and let everyone understand Webpack in 10 minutes