Skip to content

waysact/webpack-subresource-integrity

Repository files navigation

webpack-subresource-integrity

npm version Build Status Coverage Status License

If you're looking for installation and usage instructions, visit the main package.

Or you might be looking for the 1.x version with support for Webpack 1-4 and older versions of html-webpack-plugin? Visit the 1.x branch.

Upgrading from version 1.x? Read the migration guide.

If you want to hack on the package, read on — you're in the right place.

Installing from source

To install from source, clone this repository, cd into it and run

yarn

Note: this repository uses yarn workspaces; you have to use a recent version of Yarn, npm won't work. (This limitation does not apply to the built package; you can install that with npm, yarn, or any other package manager.)

Running tests

The following will run all unit tests, integration tests, examples, and lint. It will also build the package and run a smoke test on the resulting tarball:

yarn check

Adding a new test

The easiest way to add a new test is to create an example, which is an integration test. An example is a self-contained package in directory example. It should follow these simple rules:

  • When yarn webpack is invoked inside the package, it returns a zero exit code for a test pass, and a non-zero exit code for a test failure.
  • The package must have nyc installed for coverage reporting to work.
  • The package must specify * as the version for webpack-subresource-integrity so that it picks up the version from inside the workspace (instead of using a published version.)
  • The package should use expect for testing expectations.
  • The package should make sure all versions it uses for nyc, expect, webpack etc. match those used in other examples, unless there's a good reason to use a different version.
  • If the example is an end-to-end test (runs tests in the browser) it should use wsi-test-helper to do so. See its README for more information.