JSRocksHQ/slush-es20xx

Lint before building

Closed this issue · 1 comments

Right now, we have separate build and test tasks. The test tasks does linting of the source files and executes the unit tests in the transpiled files.

We don't need to transpile before linting the source files, so I believe it would make more sense to lint the source files (run JSHint and JSCS) before transpiling and abort the task if the linting fails.

The main pros are that this will provide a faster linting feedback in watch mode (when we get watch mode working), as linting errors will cause the task to fail faster -- that is, without having to wait for the transpiling task to conclude before linting source files.

The only issue I see is that this may affect separation of concerns, as part of the tests would then be part of the build task. I'll probably split the test task into a smaller (internal) "lint" task, this way we can use it as part of the build and test tasks.

//cc @jaydson

If I do this, then our test task would be an alias to mochaTest, which is unnecessary. I'm trying to find a reason to keep build and test tasks separate, but I can't think of any compelling reason:

  • It does not make much sense to run unit tests without building first, as every change you make must trigger a build before it can be tested. Even if this use case exists, one can run grunt mochaTest directly.
  • I also can't think of an use case where one would not want to run the unit tests after building.

That is, unit tests must build first, and builds should be tested. It might simplify things to have just one task.