Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(infrastructure): Set up testing #4567

Merged
merged 1 commit into from
Jul 20, 2016

Conversation

traviskaufman
Copy link
Contributor

  • npm test lints files, runs karma, reports coverages, checks coverage thresholds
  • npm run test:watch runs karma in auto-watch mode, with source maps
    for both source and test files.
  • karma is used for running tests.
  • tape is used as the actual test runner.
  • bel is used for easy DOM fixtures.
  • testdouble is used for mocking/doubles.
  • isparta is used to instrument source files for coverage.
  • istanbul is used to check and report coverage.
  • eslint-plugin-tape is used for tape-specific test linting.

resolves #4465

@@ -9,31 +9,49 @@
"build:min": "mkdir -p build && MDL_ENV=production webpack -p",
"dist": "npm run clean && npm run build && npm run build:min",
"dev": "npm run clean && MDL_ENV=development webpack-dev-server --content-base demos --inline --hot",
"lint:js": "eslint --fix packages webpack.config.js",
"postinstall": "lerna bootstrap"
"lint:js": "eslint --fix packages test webpack.config.js karma.conf.js",
Copy link
Contributor

@sgomes sgomes Jul 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to use this as a dependency for other scripts, we should probably remove --fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have it set up to run as the "pretest" script as well, so it'll execute
when "npm test" is run. However developers can also manually run it if they
wish.
On Wed, Jul 20, 2016 at 09:10 Sérgio Gomes notifications@github.com wrote:

In package.json
#4567 (comment)
:

@@ -9,31 +9,49 @@
"build:min": "mkdir -p build && MDL_ENV=production webpack -p",
"dist": "npm run clean && npm run build && npm run build:min",
"dev": "npm run clean && MDL_ENV=development webpack-dev-server --content-base demos --inline --hot",

  • "lint:js": "eslint --fix packages webpack.config.js",
  • "postinstall": "lerna bootstrap"
  • "lint:js": "eslint --fix packages test webpack.config.js karma.conf.js",

This one's meant to be manually used by developers, not as part of some
build process, right?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/google/material-design-lite/pull/4567/files/e26e3d3de0cf7001a07c785f7cb5ed0beef0b20e#r71520727,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABIV9dlHIdmCOue2CQlArCAzXAhGlvDoks5qXh5jgaJpZM4JQBo4
.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yeah good point. I guess I was thinking that running it as part of lint would save devs some time fixing stuff. But yeah maybe having a lint:fix rule which runs both eslint --fix and stylefmt Would be better.

@traviskaufman traviskaufman force-pushed the chore/test-infrastructure branch from e26e3d3 to 7811fda Compare July 20, 2016 15:39
@traviskaufman
Copy link
Contributor Author

@sgomes changes made; PTAL

* `npm test` lints files, runs karma, reports coverages, checks coverage thresholds
* `npm run test:watch` runs karma in auto-watch mode, with source maps
   for both source and test files.
* `npm run fix` attempts to fix both CSS and JS lint issues in parallel
* `npm run lint` lints JS and CSS in parallel
* [karma](https://karma-runner.github.io/1.0/index.html) is used for running tests.
* [tape](https://github.com/substack/tape) is used as the actual test runner.
* [bel](https://github.com/shama/bel) is used for easy DOM fixtures.
* [testdouble](https://github.com/testdouble/testdouble.js) is used for mocking/doubles.
* [isparta](https://github.com/douglasduteil/isparta) is used to instrument source files for coverage.
* [istanbul](https://github.com/gotwarlost/istanbul) is used to check and report coverage.
* [eslint-plugin-tape](https://github.com/atabel/eslint-plugin-tape) is used for tape-specific test linting.

resolves #4465
@traviskaufman traviskaufman force-pushed the chore/test-infrastructure branch from 7811fda to e886ee9 Compare July 20, 2016 15:41
@sgomes
Copy link
Contributor

sgomes commented Jul 20, 2016

LGTM, thanks @traviskaufman!

@traviskaufman traviskaufman merged commit bf50ee7 into master Jul 20, 2016
@traviskaufman traviskaufman deleted the chore/test-infrastructure branch July 20, 2016 17:01
@traviskaufman traviskaufman mentioned this pull request Jul 20, 2016
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants