Welcome to the Linux Foundation Forum!

Question 6.2.1, 6.2.2 and 6.2.3 are wrong

mje
mje Posts: 12
edited September 2021 in LFW211 Class Forum

6.2.1

It is written in the chapter that ^2.1.2 means 2.x.x, hence A and B both have to selected, not just B.

6.2.2

With npm run lint && npm test the last command is only executed if the first command returns success. The correct answer would be npm run lint ; npm test

6.2.3
Question

If a package dependency has a development dependency, in what scenario, if any, will the development dependency be installed?

In other words, the question is "How to install devDependencies?"

From npm help install

By default, npm install will install all modules listed as dependencies in npm help package.json.

Hence, A is the correct answer, not B. B says it is impossible to install devDependencies.

Comments

  • k0dard
    k0dard Posts: 115

    The question 1 is

    Which of the following cases would all be covered in a Semver range of ^2.1.2?

    ^2.1.2 means >= 2.1.2 < 3.0.0, so the correct answer is answer B. You can find more about semvar on the link provided in the course https://docs.npmjs.com/cli/v6/using-npm/semver/

    The question 2 asks which of the commands will execute both scripts. The only command in the answers that will execute both scripts is npm run lint && npm test. Now you can argue that it won't execute the second command if the first doesn't succeed but that was not the question and also one can argue that you don't want test executed if the lint doesn't succeed

    The question 3 is

    If a package dependency has a development dependency, in what scenario, if any, will the development dependency be installed?

    So, although you're right about npm install would install devDependencies (of the app) the question is about package dependencies, or dependencies of dependencies.
    As the course says:

    An important characteristic of development dependencies is that only top level development dependencies are installed. The development dependencies of sub-dependencies will not be installed.

  • @k0dard is correct on all fronts, I'd also add that we use && because it's cross-platform ( ; in this context won't work on windows)

This discussion has been closed.

Categories

Upcoming Training