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

Switch to evaldown for examples. #343

Merged
merged 4 commits into from
Aug 16, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ matrix:
node_js: 12
env:
- TARGET=coverage
- name: Documentation
node_js: 12
env:
- TARGET=test-docs
- name: BrowserStack IE11
node_js: 12
env:
Expand Down
12 changes: 5 additions & 7 deletions bootstrap-unexpected-markdown.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
/* global unexpected:true, expect:true, jsdom:true, createElement:true, createDocument:true */
/* global expect:true, jsdom:true, createElement:true, createDocument:true */
/* eslint no-unused-vars: "off" */

if (typeof expect === 'undefined') {
require('./test/common/node');
}

unexpected = expect;
unexpected.output.preferredWidth = 80;
const common = require('./test/common/node');
jsdom = common.jsdom;
expect = common.expect;
expect.output.preferredWidth = 80;

function sanitizeHtml(html) {
return html
Expand Down
4 changes: 3 additions & 1 deletion documentation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ bower install unexpected unexpected-dom

## Usage

```js#evaluate:false
<!-- unexpected-markdown evaluate:false -->

```javascript
const expect = require('unexpected').clone();
expect.installPlugin(require('unexpected-dom'));

Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"lint": "eslint . && prettier --check '**/*.{js,md}'",
"test": "npm run test-node && npm run test-docs",
"test-browser": "npm run build && npm run bundle && npm run build-tests && npm run bundle-tests && karma start --single-run --browsers ${BROWSER:-ChromeHeadless}",
"test-docs": "mocha `find documentation -name '*.md'`",
"test-docs": "mocha --require unexpected-markdown `find documentation -name '*.md'`",
alexjeffburke marked this conversation as resolved.
Show resolved Hide resolved
"test-node": "mocha",
"test-headless": "npm run test-browser",
"coverage": "nyc --reporter=lcov --reporter=text npm test",
Expand All @@ -26,7 +26,7 @@
"version": "offline-github-changelog --next=${npm_package_version} > CHANGELOG.md && git add CHANGELOG.md",
"postversion": "npm run generate-site && gh-pages -d site-build",
"generate-site": "generate-site --require ./bootstrap-unexpected-markdown.js",
"update-examples": "generate-site --require ./bootstrap-unexpected-markdown.js --update-examples"
"update-examples": "evaldown --comment-marker unexpected-markdown --require ./bootstrap-unexpected-markdown.js --inplace ./documentation"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -57,6 +57,7 @@
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"evaldown": "^1.2.2",
"fs-extra": "^9.0.0",
"gh-pages": "^3.0.0",
"istanbul": "^0.4.5",
Expand All @@ -78,8 +79,8 @@
"rollup-plugin-node-resolve": "^5.0.0",
"rollup-plugin-terser": "^6.0.1",
"unexpected": "^11.12.1",
"unexpected-documentation-site-generator": "^6.0.0",
"unexpected-markdown": "^5.0.0",
"unexpected-documentation-site-generator": "^7.0.1",
"unexpected-markdown": "^6.0.0",
"unexpected-snapshot": "^1.0.0"
},
"dependencies": {
Expand Down
2 changes: 2 additions & 0 deletions test/common/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ expect.addAssertion(
);
})
);

module.exports = { expect, jsdom };
1 change: 0 additions & 1 deletion test/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
--require ./test/common/node.js
--require ./bootstrap-unexpected-markdown.js
--require unexpected-markdown
--exclude test/common/*.js
--recursive