You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@annotator.apache.org by bi...@apache.org on 2018/10/04 19:31:46 UTC
[incubator-annotator] 01/01: Add `yarn validate` for JSON testing
This is an automated email from the ASF dual-hosted git repository.
bigbluehat pushed a commit to branch add-validate-yarn-script
in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git
commit d339f189be29838ef0ae9614f380cec831763df4
Author: Benjamin Young <by...@wiley.com>
AuthorDate: Thu Oct 4 15:30:48 2018 -0400
Add `yarn validate` for JSON testing
Reduces the `yarn test` (run by travis, pre-commit, etc) to just code testing.
---
README.md | 20 ++++++++++++--------
package.json | 3 ++-
test/data-model.mjs | 2 +-
test/mocha.opts | 2 --
4 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index 988f5be..d943593 100644
--- a/README.md
+++ b/README.md
@@ -46,14 +46,6 @@ $ yarn install
$ yarn test
```
-By default the Web Annotation JSON-related tests will skipped. To use those
-with a specific local file you can use the `--url` parameter plus a local file
-path.
-
-```sh
-$ yarn test --url ../anno1.json
-```
-
##### Run localhost demo server
```sh
@@ -63,6 +55,18 @@ $ yarn start
Once the test server has started, you can browse a local demo, and run tests in
a browser by visiting `http://localhost:8080/`.
+
+## Web Annotation Data Model Validation
+
+If you have any Web Annotation Data Model JSON documents, you can validate them
+using the `validate` script:
+
+
+```sh
+$ yarn validate --url ../anno1.json
+```
+
+
# License
Apache License 2.0
diff --git a/package.json b/package.json
index 8ba1380..3d12dc4 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,8 @@
"lint": "eslint . --ext js,mjs --fix --quiet",
"prepare": "lerna run prepare",
"start": "webpack-serve",
- "test": "cross-env BABEL_ENV=test nyc mocha -r esm"
+ "test": "cross-env BABEL_ENV=test nyc mocha -r esm packages/*/test/**/*.mjs",
+ "validate": "cross-env BABEL_ENV=test nyc mocha -r esm test/**/*.mjs"
},
"devDependencies": {
"@babel/cli": "^7.0.0-beta.42",
diff --git a/test/data-model.mjs b/test/data-model.mjs
index d85cfbe..3c7fc47 100644
--- a/test/data-model.mjs
+++ b/test/data-model.mjs
@@ -37,7 +37,7 @@ const musts = JSON.parse(
)
);
-describe('Test schemas', () => {
+describe('Test JSON against Schemas', () => {
let data = '';
before(function() {
diff --git a/test/mocha.opts b/test/mocha.opts
index 2d8e8b1..18d8f24 100644
--- a/test/mocha.opts
+++ b/test/mocha.opts
@@ -3,5 +3,3 @@
-r chai/register-assert
--recursive
--watch-extensions mjs
-packages/*/test/**/*.mjs
-test/**/*.mjs