From 1314fbc6901fa36b5f196932fc4f98a45010b1eb Mon Sep 17 00:00:00 2001 From: Fred Chasen Date: Tue, 8 May 2018 17:41:43 -0700 Subject: [PATCH] Update readme --- README.md | 25 +++++++++++++++++++++---- package.json | 3 ++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fb4955b..891cb19 100755 --- a/README.md +++ b/README.md @@ -60,9 +60,26 @@ Build the `dist` output ```sh $ npm run prepare ``` + ## Testing -To test the pdf output, you'll need to install ghostscript locally. +Testing for Paged.js uses [Jest](https://facebook.github.io/jest/en/) but is split into Tests and Specs. + +### Tests + +Unit tests for Chunker and Polisher methods are run in node using JSDOM. + +```bash +npm run tests +``` + +### Specs + +Specs run a html file in Chrome (using puppeteer) to test against CSS specifications. + +They can also output a pdf and compare pages (one at a time) in that PDF with samples PDFs (saved as images). + +To test the pdf output of specs, you'll need to install ghostscript locally. ```bash brew install ghostscript @@ -71,17 +88,17 @@ brew install ghostscript Then run the jest tests in puppeteer. ```bash -npm test +npm run specs ``` To debug the results of a test in a browser you can add `NODE_ENV=debug` ```bash -NODE_ENV=debug npm test +NODE_ENV=debug npm run specs ``` To update the stored pdf images you can run ```bash -npm test -- -u +npm run specs -- --updateSnapshot ``` diff --git a/package.json b/package.json index 84ab5d1..4acc53b 100755 --- a/package.json +++ b/package.json @@ -36,7 +36,8 @@ "scripts": { "build": "./node_modules/.bin/rollup -c", "start": "./node_modules/.bin/rollup -w -c rollup.server.config.js", - "test": "jest --config=tests/jest.config.js", + "test": "npm run tests && npm run specs", + "tests": "jest --config=tests/jest.config.js", "specs": "jest --config=specs/jest.config.js", "compile": "./node_modules/.bin/babel src/ -d lib/", "pretest": "npm run build", -- 2.22.0