Skip to content

Commit 967ab44

Browse files
Merge pull request #212 from remarkablemark/test/integration
test(integration): add tests for UMD bundle and fail build if there are warnings
2 parents 223bdec + 1ba95f5 commit 967ab44

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- run: npm run lint
2020
- run: npm run lint:dts
2121
- run: npm run test:ci
22-
- run: npm run build
22+
- run: npm run test:integration
2323
- run: npm run benchmark
2424
- name: Coveralls
2525
uses: coverallsapp/github-action@master

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@
77
"module": "index.mjs",
88
"scripts": {
99
"benchmark": "node benchmark",
10-
"build": "rollup --config",
10+
"build": "rollup --config --failAfterWarnings",
1111
"clean": "rimraf dist",
1212
"lint": "eslint --ignore-path .gitignore --ignore-pattern /examples/ .",
1313
"lint:dts": "dtslint .",
1414
"lint:fix": "npm run lint -- --fix",
1515
"prepublishOnly": "npm run lint && npm run lint:dts && npm run test:ci && npm run clean && npm run build",
1616
"release": "standard-version --no-verify",
17-
"test": "jest --coverage",
17+
"test": "jest --coverage --testPathIgnorePatterns test/integration/",
1818
"test:ci": "npm test -- --ci",
19+
"test:integration": "npm run build && jest test/integration/",
1920
"test:watch": "npm test -- --watch"
2021
},
2122
"repository": {

test/integration/index.test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
describe.each([
2+
['unminified', '../../dist/html-react-parser'],
3+
['minified', '../../dist/html-react-parser.min']
4+
])('UMD %s', (_type, path) => {
5+
const parse = require(path);
6+
7+
it('exports the parser', () => {
8+
expect(parse).toBeInstanceOf(Function);
9+
});
10+
11+
it('exports default', () => {
12+
expect(parse.default).toBeInstanceOf(Function);
13+
});
14+
15+
it('exports domToReact', () => {
16+
expect(parse.domToReact).toBeInstanceOf(Function);
17+
});
18+
19+
it('exports htmlToDOM', () => {
20+
expect(parse.htmlToDOM).toBeInstanceOf(Function);
21+
});
22+
23+
it('exports attributesToProps', () => {
24+
expect(parse.attributesToProps).toBeInstanceOf(Function);
25+
});
26+
});

0 commit comments

Comments
 (0)