Skip to content

Commit

Permalink
[test:input] Set up HTTP request mocking (#136)
Browse files Browse the repository at this point in the history
* [site:test] Fix browser tests again

expect.js doesn't play nicely with Babel, so it
shouldn't be transformed by Babelify.^1 Note that
the ignore option in Babelify is buggy ^2, so
this might not work on your end.

^1 Automattic/expect.js#149
^2 babel/babelify#265

* [test:input] Set up HTTP request mocking

Set up proper HTTP request mocking by mocking
exports with mock-require. Not possible in the
browser, but it wasn't before, so this counts
as an improvement.

Previously done by nock, but this didn't work for
requests made through sync-request, as that
spawns a child process over which nock has no
control.

See #68
See 509d911
Close #134

* [test:input] Increase coverage of input plugins

See #123 

* [package] Add non-npm patch to dependencies

See babel/babelify#267
  • Loading branch information
larsgw committed May 2, 2018
1 parent 32190e0 commit 90cd68c
Show file tree
Hide file tree
Showing 21 changed files with 17,138 additions and 2,224 deletions.
3 changes: 2 additions & 1 deletion .babelrc
Expand Up @@ -10,7 +10,8 @@
],
"plugins": [
"@babel/plugin-proposal-unicode-property-regex",
"@babel/plugin-proposal-class-properties"
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread"
],
"env": {
"test": {
Expand Down
30 changes: 23 additions & 7 deletions CONTRIBUTING.md
Expand Up @@ -17,17 +17,33 @@ Install dependencies:
Then you can run the scripts available in `package.json`:

* `test` runs the Mocha suite
* `test:live` doesn't mock http(s) requests
* `test:update` updates the mocking data
* To update mocking data for individual APIs `test:update:doi` and `test:update:wikidata`
* `compile` runs Babel (necessary for the repo to work as a module)
* `lint` runs the code linter
* `lint:src` does it for the source files,
* `lint:test` does it for the test suite,
* `lint:tools` does it for the various scripts, and
* `lint:src` does it for the source files
* `lint:test` does it for the test suite
* `lint:tools` does it for the various scripts
* `lint:bin` does it for the CLI
* `dist:regular-*` makes a Browserify bundle
* `dist:regular-main` bundles the source files,
* `dist:regular-debug` does the same with source maps, and
* The following bundles can be created:
* `dist:regular-main` bundles the source files
* `dist:debug` does the same but with source maps
* `dist:regular-test` bundles the test suite
* `dist:minify-*` minifies the bundles mentioned above, apart from the debug one
* To minify, run:
* `dist:minify-main` minifies the source file bundle
* `dist:minify-test` minifies the test suite bundle
* Combine this like so:
* `dist:regular` creates all bundles
* `dist:minify` minifies all bundles
* `dist:main` bundles and minifies the source files
* `dist:test` bundles and minifies the test suite.
* `dist` creates and minifies all bundles
* Generating other files is done like this:
* `generate:files` is an alias for `dist` mentioned above
* `generate:docs` generates the JSDoc files
* `generate:disc` generates the bundle disc visualisation
* `generate` generates everything mentioned above

You can run a given script with:

Expand Down

0 comments on commit 90cd68c

Please sign in to comment.