@cucumber/html-formatter 16.0.1 → 19.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +51 -0
- package/.mocharc.json +9 -3
- package/.prettierrc.json +5 -0
- package/dist/main.css +24 -14
- package/dist/main.js +1 -1
- package/dist/main.js.LICENSE.txt +2 -1
- package/dist/package.json +52 -30
- package/dist/src/CucumberHtmlStream.d.ts +1 -1
- package/dist/src/CucumberHtmlStream.d.ts.map +1 -1
- package/dist/src/CucumberHtmlStream.js +2 -1
- package/dist/src/CucumberHtmlStream.js.map +1 -1
- package/dist/src/main.d.ts +1 -0
- package/dist/src/main.d.ts.map +1 -1
- package/dist/src/main.js +7 -12
- package/dist/src/main.js.map +1 -1
- package/dist/src/styles.scss +10 -0
- package/dist/test/CucumberHtmlStreamTest.js +6 -6
- package/dist/test/CucumberHtmlStreamTest.js.map +1 -1
- package/dist/test/acceptance.d.ts +2 -0
- package/dist/test/acceptance.d.ts.map +1 -0
- package/dist/test/acceptance.js +63 -0
- package/dist/test/acceptance.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +52 -30
- package/src/CucumberHtmlStream.ts +21 -10
- package/src/main.tsx +13 -26
- package/src/styles.scss +10 -0
- package/test/CucumberHtmlStreamTest.ts +19 -6
- package/test/acceptance.ts +62 -0
- package/tsconfig.build.json +5 -3
- package/tsconfig.json +23 -1
- package/.github/ISSUE_TEMPLATE.md +0 -5
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -5
- package/.rsync +0 -3
- package/.subrepo +0 -1
- package/Dockerfile +0 -15
- package/Makefile +0 -26
- package/README.md +0 -31
- package/bin/cucumber-html-formatter.js +0 -3
- package/check.js +0 -22
- package/default.mk +0 -88
- package/dist/src/cli-main.d.ts +0 -2
- package/dist/src/cli-main.d.ts.map +0 -1
- package/dist/src/cli-main.js +0 -22
- package/dist/src/cli-main.js.map +0 -1
- package/src/cli-main.ts +0 -25
package/package.json
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cucumber/html-formatter",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.0.0",
|
|
4
4
|
"description": "HTML formatter for Cucumber",
|
|
5
|
-
"bin": {
|
|
6
|
-
"cucumber-html-formatter": "bin/cucumber-html-formatter.js"
|
|
7
|
-
},
|
|
8
5
|
"main": "dist/src/CucumberHtmlStream.js",
|
|
9
6
|
"types": "dist/src/CucumberHtmlStream.d.ts",
|
|
10
7
|
"repository": {
|
|
@@ -14,38 +11,63 @@
|
|
|
14
11
|
"author": "Aslak Hellesøy",
|
|
15
12
|
"license": "MIT",
|
|
16
13
|
"scripts": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
14
|
+
"clean": "shx rm -rf dist",
|
|
15
|
+
"build:tsc": "tsc --build tsconfig.build.json",
|
|
16
|
+
"build:webpack": "webpack",
|
|
17
|
+
"build": "npm run clean && npm run build:tsc && npm run prepare && npm run build:webpack",
|
|
18
|
+
"prepare": "shx mkdir -p dist/src && shx cp src/*.scss dist/src && shx cp src/index.mustache.html dist/src",
|
|
19
|
+
"test": "mocha --exclude test/acceptance.ts",
|
|
20
|
+
"prepublishOnly": "npm run build",
|
|
21
|
+
"eslint:fix": "eslint --ext ts,tsx --max-warnings 0 --fix src test",
|
|
22
|
+
"eslint": "eslint --ext ts,tsx --max-warnings 0 src test",
|
|
23
|
+
"validate": "mocha test/acceptance.ts"
|
|
19
24
|
},
|
|
20
|
-
"
|
|
21
|
-
"@cucumber/messages": "
|
|
22
|
-
"commander": "8.0.0",
|
|
23
|
-
"source-map-support": "0.5.19"
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@cucumber/messages": ">=17"
|
|
24
27
|
},
|
|
25
28
|
"devDependencies": {
|
|
26
|
-
"@babel/core": "7.
|
|
27
|
-
"@cucumber/
|
|
28
|
-
"@cucumber/gherkin
|
|
29
|
-
"@cucumber/
|
|
29
|
+
"@babel/core": "7.17.8",
|
|
30
|
+
"@cucumber/compatibility-kit": "^9.1.2",
|
|
31
|
+
"@cucumber/gherkin": "22.0.0",
|
|
32
|
+
"@cucumber/gherkin-streams": "^5.0.0",
|
|
33
|
+
"@cucumber/gherkin-utils": "^7.0.0",
|
|
34
|
+
"@cucumber/message-streams": "^4.0.0",
|
|
35
|
+
"@cucumber/messages": "^17.1.1",
|
|
30
36
|
"@cucumber/query": "^11.0.0",
|
|
31
|
-
"@cucumber/react": "^
|
|
32
|
-
"@types/
|
|
33
|
-
"@types/
|
|
34
|
-
"@types/
|
|
35
|
-
"@types/react
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
37
|
+
"@cucumber/react": "^19.2.0",
|
|
38
|
+
"@types/glob": "^7.2.0",
|
|
39
|
+
"@types/mocha": "9.1.0",
|
|
40
|
+
"@types/node": "16.11.26",
|
|
41
|
+
"@types/react": "17.0.41",
|
|
42
|
+
"@types/react-dom": "17.0.14",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^5.10.1",
|
|
44
|
+
"@typescript-eslint/parser": "^5.10.1",
|
|
45
|
+
"babel-loader": "8.2.4",
|
|
46
|
+
"css-loader": "6.7.1",
|
|
47
|
+
"eslint": "^8.7.0",
|
|
48
|
+
"eslint-config-prettier": "^8.3.0",
|
|
49
|
+
"eslint-plugin-import": "^2.25.4",
|
|
50
|
+
"eslint-plugin-node": "^11.1.0",
|
|
51
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
52
|
+
"eslint-plugin-react": "^7.28.0",
|
|
53
|
+
"eslint-plugin-react-hooks": "^4.3.0",
|
|
54
|
+
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
55
|
+
"glob": "^7.2.0",
|
|
56
|
+
"mini-css-extract-plugin": "2.6.0",
|
|
57
|
+
"mocha": "9.2.2",
|
|
58
|
+
"prettier": "^2.5.1",
|
|
59
|
+
"puppeteer": "^13.1.2",
|
|
41
60
|
"react": "17.0.2",
|
|
42
61
|
"react-dom": "17.0.2",
|
|
43
|
-
"sass
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
62
|
+
"sass": "1.49.9",
|
|
63
|
+
"sass-loader": "12.6.0",
|
|
64
|
+
"shx": "^0.3.4",
|
|
65
|
+
"source-map-support": "0.5.21",
|
|
66
|
+
"ts-loader": "9.2.8",
|
|
67
|
+
"ts-node": "10.7.0",
|
|
68
|
+
"typescript": "4.6.2",
|
|
69
|
+
"webpack": "5.70.0",
|
|
70
|
+
"webpack-cli": "4.9.2"
|
|
49
71
|
},
|
|
50
72
|
"bugs": {
|
|
51
73
|
"url": "https://github.com/cucumber/cucumber/issues"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import * as messages from '@cucumber/messages'
|
|
1
2
|
import fs from 'fs'
|
|
2
3
|
import { Readable, Transform, TransformCallback } from 'stream'
|
|
3
|
-
import * as messages from '@cucumber/messages'
|
|
4
4
|
|
|
5
5
|
export default class CucumberHtmlStream extends Transform {
|
|
6
6
|
private template: string | null = null
|
|
@@ -11,7 +11,10 @@ export default class CucumberHtmlStream extends Transform {
|
|
|
11
11
|
* @param cssPath
|
|
12
12
|
* @param jsPath
|
|
13
13
|
*/
|
|
14
|
-
constructor(
|
|
14
|
+
constructor(
|
|
15
|
+
private readonly cssPath: string,
|
|
16
|
+
private readonly jsPath: string
|
|
17
|
+
) {
|
|
15
18
|
super({ objectMode: true })
|
|
16
19
|
}
|
|
17
20
|
|
|
@@ -46,7 +49,6 @@ export default class CucumberHtmlStream extends Transform {
|
|
|
46
49
|
if (err) return callback(err)
|
|
47
50
|
this.writeTemplateBetween('{{css}}', '{{messages}}', (err) => {
|
|
48
51
|
if (err) return callback(err)
|
|
49
|
-
// this.writeResource("cucumber-react.css", callback);
|
|
50
52
|
callback()
|
|
51
53
|
})
|
|
52
54
|
})
|
|
@@ -80,22 +82,31 @@ export default class CucumberHtmlStream extends Transform {
|
|
|
80
82
|
) {
|
|
81
83
|
this.readTemplate((err, template) => {
|
|
82
84
|
if (err) return callback(err)
|
|
83
|
-
|
|
85
|
+
if (!template)
|
|
86
|
+
return callback(new Error('template is required if error is missing'))
|
|
87
|
+
const beginIndex =
|
|
88
|
+
begin == null ? 0 : template.indexOf(begin) + begin.length
|
|
84
89
|
const endIndex = end == null ? template.length : template.indexOf(end)
|
|
85
90
|
this.push(template.substring(beginIndex, endIndex))
|
|
86
91
|
callback()
|
|
87
92
|
})
|
|
88
93
|
}
|
|
89
94
|
|
|
90
|
-
private readTemplate(
|
|
95
|
+
private readTemplate(
|
|
96
|
+
callback: (error?: Error | null, data?: string) => void
|
|
97
|
+
) {
|
|
91
98
|
if (this.template !== null) {
|
|
92
99
|
return callback(null, this.template)
|
|
93
100
|
}
|
|
94
|
-
fs.readFile(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
fs.readFile(
|
|
102
|
+
__dirname + '/index.mustache.html',
|
|
103
|
+
{ encoding: 'utf-8' },
|
|
104
|
+
(err, template) => {
|
|
105
|
+
if (err) return callback(err)
|
|
106
|
+
this.template = template
|
|
107
|
+
return callback(null, template)
|
|
108
|
+
}
|
|
109
|
+
)
|
|
99
110
|
}
|
|
100
111
|
|
|
101
112
|
private writeMessage(envelope: messages.Envelope) {
|
package/src/main.tsx
CHANGED
|
@@ -1,40 +1,27 @@
|
|
|
1
|
+
import './styles.scss'
|
|
2
|
+
|
|
1
3
|
import * as messages from '@cucumber/messages'
|
|
2
|
-
import {
|
|
3
|
-
QueriesWrapper,
|
|
4
|
-
EnvelopesQuery,
|
|
5
|
-
FilteredResults,
|
|
6
|
-
searchFromURLParams,
|
|
7
|
-
} from '@cucumber/react'
|
|
8
|
-
import { Query as GherkinQuery } from '@cucumber/gherkin-utils'
|
|
9
|
-
import { Query as CucumberQuery } from '@cucumber/query'
|
|
4
|
+
import { components, searchFromURLParams } from '@cucumber/react'
|
|
10
5
|
import React from 'react'
|
|
11
6
|
import ReactDOM from 'react-dom'
|
|
12
7
|
|
|
8
|
+
const { CucumberReact } = components
|
|
9
|
+
const { FilteredResults, EnvelopesWrapper, SearchWrapper } = components.app
|
|
10
|
+
|
|
13
11
|
declare global {
|
|
14
12
|
interface Window {
|
|
15
13
|
CUCUMBER_MESSAGES: messages.Envelope[]
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
16
|
|
|
19
|
-
const gherkinQuery = new GherkinQuery()
|
|
20
|
-
const cucumberQuery = new CucumberQuery()
|
|
21
|
-
const envelopesQuery = new EnvelopesQuery()
|
|
22
|
-
|
|
23
|
-
for (const envelope of window.CUCUMBER_MESSAGES as messages.Envelope[]) {
|
|
24
|
-
gherkinQuery.update(envelope)
|
|
25
|
-
cucumberQuery.update(envelope)
|
|
26
|
-
envelopesQuery.update(envelope)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
17
|
const app = (
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
</QueriesWrapper>
|
|
18
|
+
<CucumberReact theme="auto">
|
|
19
|
+
<EnvelopesWrapper envelopes={window.CUCUMBER_MESSAGES}>
|
|
20
|
+
<SearchWrapper {...searchFromURLParams()}>
|
|
21
|
+
<FilteredResults className="html-formatter" />
|
|
22
|
+
</SearchWrapper>
|
|
23
|
+
</EnvelopesWrapper>
|
|
24
|
+
</CucumberReact>
|
|
38
25
|
)
|
|
39
26
|
|
|
40
27
|
ReactDOM.render(app, document.getElementById('content'))
|
package/src/styles.scss
ADDED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import * as messages from '@cucumber/messages'
|
|
2
|
-
import CucumberHtmlStream from '../src/CucumberHtmlStream'
|
|
3
|
-
import { Writable } from 'stream'
|
|
4
2
|
import assert from 'assert'
|
|
3
|
+
import { Writable } from 'stream'
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
import CucumberHtmlStream from '../src/CucumberHtmlStream'
|
|
6
|
+
|
|
7
|
+
async function renderAsHtml(
|
|
8
|
+
...envelopes: messages.Envelope[]
|
|
9
|
+
): Promise<string> {
|
|
7
10
|
return new Promise((resolve, reject) => {
|
|
8
11
|
let html = ''
|
|
9
12
|
const sink: Writable = new Writable({
|
|
10
|
-
write(
|
|
13
|
+
write(
|
|
14
|
+
chunk: string,
|
|
15
|
+
_: string,
|
|
16
|
+
callback: (error?: Error | null) => void
|
|
17
|
+
): void {
|
|
11
18
|
html += chunk
|
|
12
19
|
callback()
|
|
13
20
|
},
|
|
@@ -40,7 +47,9 @@ describe('CucumberHtmlStream', () => {
|
|
|
40
47
|
},
|
|
41
48
|
}
|
|
42
49
|
const html = await renderAsHtml(e1)
|
|
43
|
-
assert(
|
|
50
|
+
assert(
|
|
51
|
+
html.indexOf(`window.CUCUMBER_MESSAGES = [${JSON.stringify(e1)}]`) >= 0
|
|
52
|
+
)
|
|
44
53
|
})
|
|
45
54
|
|
|
46
55
|
it('writes two messages to html', async () => {
|
|
@@ -57,7 +66,11 @@ describe('CucumberHtmlStream', () => {
|
|
|
57
66
|
}
|
|
58
67
|
const html = await renderAsHtml(e1, e2)
|
|
59
68
|
assert(
|
|
60
|
-
html.indexOf(
|
|
69
|
+
html.indexOf(
|
|
70
|
+
`window.CUCUMBER_MESSAGES = [${JSON.stringify(e1)},${JSON.stringify(
|
|
71
|
+
e2
|
|
72
|
+
)}]`
|
|
73
|
+
) >= 0
|
|
61
74
|
)
|
|
62
75
|
})
|
|
63
76
|
})
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { NdjsonToMessageStream } from '@cucumber/message-streams'
|
|
2
|
+
import assert from 'assert'
|
|
3
|
+
import fs from 'fs'
|
|
4
|
+
import glob from 'glob'
|
|
5
|
+
import path from 'path'
|
|
6
|
+
import puppeteer from 'puppeteer'
|
|
7
|
+
import { PassThrough, pipeline } from 'stream'
|
|
8
|
+
|
|
9
|
+
import CucumberHtmlStream from '../src/CucumberHtmlStream'
|
|
10
|
+
|
|
11
|
+
async function canRenderHtml(html: string): Promise<boolean> {
|
|
12
|
+
const browser = await puppeteer.launch({
|
|
13
|
+
headless: true,
|
|
14
|
+
args: ['--no-sandbox'],
|
|
15
|
+
})
|
|
16
|
+
const page = await browser.newPage()
|
|
17
|
+
await page.setContent(html)
|
|
18
|
+
const dynamicHTML = await page.evaluate(() => {
|
|
19
|
+
const content = document.querySelector('[data-testid="cucumber-react"]')
|
|
20
|
+
return content && content.innerHTML
|
|
21
|
+
})
|
|
22
|
+
await browser.close()
|
|
23
|
+
|
|
24
|
+
if (!dynamicHTML) {
|
|
25
|
+
return false
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return true
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
describe('html-formatter', () => {
|
|
32
|
+
const files = glob.sync(
|
|
33
|
+
`./node_modules/@cucumber/compatibility-kit/features/**/*.ndjson`
|
|
34
|
+
)
|
|
35
|
+
for (const ndjson of files) {
|
|
36
|
+
it(`can render ${path.basename(ndjson, '.ndjson')}`, async () => {
|
|
37
|
+
const ndjsonData = fs.createReadStream(ndjson, { encoding: 'utf-8' })
|
|
38
|
+
const toMessageStream = new NdjsonToMessageStream()
|
|
39
|
+
const htmlData = await new Promise<string>((resolve, reject) => {
|
|
40
|
+
const chunks: Buffer[] = []
|
|
41
|
+
const out = new PassThrough()
|
|
42
|
+
.on('data', (chunk) => chunks.push(Buffer.from(chunk)))
|
|
43
|
+
.on('end', () => resolve(Buffer.concat(chunks).toString()))
|
|
44
|
+
pipeline(
|
|
45
|
+
ndjsonData,
|
|
46
|
+
toMessageStream,
|
|
47
|
+
new CucumberHtmlStream(
|
|
48
|
+
__dirname + '/../dist/main.css',
|
|
49
|
+
__dirname + '/../dist/main.js'
|
|
50
|
+
),
|
|
51
|
+
out,
|
|
52
|
+
(err: Error) => {
|
|
53
|
+
if (err) {
|
|
54
|
+
reject(err)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
})
|
|
59
|
+
assert.ok(await canRenderHtml(htmlData.toString()))
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
})
|
package/tsconfig.build.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"rootDir": ".",
|
|
5
|
-
"outDir": "dist"
|
|
5
|
+
"outDir": "dist",
|
|
6
|
+
"composite": true,
|
|
7
|
+
"declarationMap": true,
|
|
8
|
+
"noEmit": false
|
|
6
9
|
},
|
|
7
10
|
"include": [
|
|
8
11
|
"src",
|
|
9
12
|
"test",
|
|
10
|
-
"features",
|
|
11
13
|
"package.json"
|
|
12
14
|
]
|
|
13
15
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"sourceMap": true,
|
|
6
|
+
"allowJs": false,
|
|
7
|
+
"resolveJsonModule": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"noImplicitAny": true,
|
|
10
|
+
"downlevelIteration": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"strictNullChecks": true,
|
|
13
|
+
"experimentalDecorators": true,
|
|
14
|
+
"module": "CommonJS",
|
|
15
|
+
"lib": [
|
|
16
|
+
"ES6",
|
|
17
|
+
"dom"
|
|
18
|
+
],
|
|
19
|
+
"target": "ES6",
|
|
20
|
+
"moduleResolution": "node",
|
|
21
|
+
"allowSyntheticDefaultImports": true,
|
|
22
|
+
"noEmit": true,
|
|
23
|
+
"jsx": "react"
|
|
24
|
+
}
|
|
3
25
|
}
|
package/.rsync
DELETED
package/.subrepo
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
cucumber/html-formatter
|
package/Dockerfile
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# cucumber/html-formatter
|
|
2
|
-
FROM node:16-alpine
|
|
3
|
-
|
|
4
|
-
RUN mkdir -p /home/node/app
|
|
5
|
-
ADD src /home/node/app/src
|
|
6
|
-
ADD test /home/node/app/test
|
|
7
|
-
ADD bin /home/node/app/bin
|
|
8
|
-
ADD package.json /home/node/app/package.json
|
|
9
|
-
ADD tsconfig.json /home/node/app/tsconfig.json
|
|
10
|
-
ADD webpack.config.js /home/node/app/webpack.config.js
|
|
11
|
-
RUN cd /home/node/app && npm install
|
|
12
|
-
RUN cd /home/node/app && npm run build
|
|
13
|
-
|
|
14
|
-
USER node
|
|
15
|
-
ENTRYPOINT [ "/home/node/app/bin/cucumber-html-formatter.js" ]
|
package/Makefile
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
include default.mk
|
|
2
|
-
|
|
3
|
-
CCK_NDJSONS = $(shell find ../../compatibility-kit/javascript/features -name "*.ndjson")
|
|
4
|
-
HTML_REPORTS = $(patsubst ../../compatibility-kit/javascript/features/%.ndjson,acceptance/%.html,$(CCK_NDJSONS))
|
|
5
|
-
HTML_REPORT_CHECKS = $(patsubst acceptance/%.html,acceptance/%.html.checked,$(HTML_REPORTS))
|
|
6
|
-
|
|
7
|
-
.built: webpack.config.js dist/main.js dist/src/index.mustache.html
|
|
8
|
-
|
|
9
|
-
dist/main.js: dist/src/main.js
|
|
10
|
-
../../node_modules/.bin/webpack-cli
|
|
11
|
-
|
|
12
|
-
dist/src/main.js:
|
|
13
|
-
npm run prepublishOnly
|
|
14
|
-
|
|
15
|
-
dist/src/index.mustache.html: src/index.mustache.html
|
|
16
|
-
cp $< $@
|
|
17
|
-
|
|
18
|
-
.tested: $(HTML_REPORT_CHECKS)
|
|
19
|
-
|
|
20
|
-
.PRECIOUS: acceptance/%.html
|
|
21
|
-
acceptance/%.html: ../../compatibility-kit/javascript/features/%.ndjson .built
|
|
22
|
-
mkdir -p $(@D)
|
|
23
|
-
cat $< | ./bin/cucumber-html-formatter.js > $@
|
|
24
|
-
|
|
25
|
-
acceptance/%.html.checked: acceptance/%.html
|
|
26
|
-
node check.js $< > $@
|
package/README.md
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# cucumber-html-formatter
|
|
2
|
-
|
|
3
|
-
For general information, see the parent [README.md](../README.md)
|
|
4
|
-
|
|
5
|
-
## Hacking
|
|
6
|
-
|
|
7
|
-
While hacking on this module you may want to try it out manually. For example,
|
|
8
|
-
to generate a report with random results for the `.feature` files used in gherkin's
|
|
9
|
-
test suite:
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
cd ../../gherkin
|
|
13
|
-
../fake-cucumber/javascript/bin/fake-cucumber \
|
|
14
|
-
--format ndjson \
|
|
15
|
-
testdata/good/*.feature | \
|
|
16
|
-
../html-formatter/javascript/bin/cucumber-html-formatter.js \
|
|
17
|
-
--format ndjson > \
|
|
18
|
-
gherkin.html
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Note that this will only work if `package.json` points to released versions. It won't
|
|
22
|
-
work as long as there are `file:` dependencies - you'll get a React error.
|
|
23
|
-
|
|
24
|
-
## Docker image
|
|
25
|
-
|
|
26
|
-
The Docker image is automatically built on docker hub, but you can also build it locally:
|
|
27
|
-
|
|
28
|
-
```
|
|
29
|
-
source ../../scripts/functions.sh
|
|
30
|
-
docker_build Dockerfile
|
|
31
|
-
```
|
package/check.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const path = process.argv[2]
|
|
3
|
-
const html = fs.readFileSync(path, 'utf-8')
|
|
4
|
-
const puppeteer = require('puppeteer')
|
|
5
|
-
|
|
6
|
-
async function check() {
|
|
7
|
-
const browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox'] })
|
|
8
|
-
const page = await browser.newPage()
|
|
9
|
-
await page.setContent(html)
|
|
10
|
-
const dynamicHTML = await page.evaluate(() => {
|
|
11
|
-
const content = document.querySelector('.cucumber-react')
|
|
12
|
-
return content && content.innerHTML
|
|
13
|
-
})
|
|
14
|
-
await browser.close()
|
|
15
|
-
|
|
16
|
-
if(!dynamicHTML) throw new Error(`The file ${path} did not render a .cucumber-react element. Inspect manually.`)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
check().then(() => console.log(`${path} rendered OK!`)).catch((err) => {
|
|
20
|
-
console.error(err.stack)
|
|
21
|
-
process.exit(1)
|
|
22
|
-
})
|
package/default.mk
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
SHELL := /usr/bin/env bash
|
|
2
|
-
# https://stackoverflow.com/questions/2483182/recursive-wildcards-in-gnu-make
|
|
3
|
-
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
|
|
4
|
-
TYPESCRIPT_SOURCE_FILES = $(sort $(call rwildcard,src test,*.ts *.tsx))
|
|
5
|
-
PRIVATE = $(shell node -e "console.log(require('./package.json').private)")
|
|
6
|
-
IS_TESTDATA = $(findstring -testdata,${CURDIR})
|
|
7
|
-
NPM_MODULE = $(shell cat package.json | jq .name --raw-output)
|
|
8
|
-
|
|
9
|
-
default: .tested
|
|
10
|
-
.PHONY: default
|
|
11
|
-
|
|
12
|
-
../../node_modules ../../package-lock.json: package.json
|
|
13
|
-
cd ../.. && npm install
|
|
14
|
-
|
|
15
|
-
.codegen:
|
|
16
|
-
touch $@
|
|
17
|
-
|
|
18
|
-
.tested: .tested-npm .built
|
|
19
|
-
|
|
20
|
-
.built: $(TYPESCRIPT_SOURCE_FILES) ../../node_modules ../../package-lock.json .codegen
|
|
21
|
-
pushd ../.. && \
|
|
22
|
-
npm run build && \
|
|
23
|
-
popd && \
|
|
24
|
-
touch $@
|
|
25
|
-
|
|
26
|
-
.tested-npm: $(TYPESCRIPT_SOURCE_FILES) ../../node_modules ../../package-lock.json .codegen
|
|
27
|
-
npm run test
|
|
28
|
-
touch $@
|
|
29
|
-
|
|
30
|
-
pre-release: clean update-version update-dependencies default
|
|
31
|
-
.PHONY: pre-release
|
|
32
|
-
|
|
33
|
-
update-dependencies:
|
|
34
|
-
../../node_modules/.bin/npm-check-updates --upgrade --reject hast-util-sanitize,@types/node
|
|
35
|
-
.PHONY: update-dependencies
|
|
36
|
-
|
|
37
|
-
update-version:
|
|
38
|
-
ifeq ($(IS_TESTDATA),-testdata)
|
|
39
|
-
# no-op
|
|
40
|
-
else
|
|
41
|
-
ifdef NEW_VERSION
|
|
42
|
-
npm --no-git-tag-version --allow-same-version version "$(NEW_VERSION)"
|
|
43
|
-
# Update all npm packages that depend on us
|
|
44
|
-
pushd ../.. && \
|
|
45
|
-
./scripts/npm-each update_npm_dependency_if_exists package.json "$(NPM_MODULE)" "$(NEW_VERSION)"
|
|
46
|
-
# npm install
|
|
47
|
-
else
|
|
48
|
-
@echo -e "\033[0;31mNEW_VERSION is not defined. Can't update version :-(\033[0m"
|
|
49
|
-
exit 1
|
|
50
|
-
endif
|
|
51
|
-
endif
|
|
52
|
-
.PHONY: update-version
|
|
53
|
-
|
|
54
|
-
publish: .codegen
|
|
55
|
-
ifeq ($(IS_TESTDATA),-testdata)
|
|
56
|
-
# no-op
|
|
57
|
-
else
|
|
58
|
-
ifneq (true,$(PRIVATE))
|
|
59
|
-
npm publish --access public
|
|
60
|
-
else
|
|
61
|
-
@echo "Not publishing private npm module"
|
|
62
|
-
endif
|
|
63
|
-
endif
|
|
64
|
-
.PHONY: publish
|
|
65
|
-
|
|
66
|
-
post-release:
|
|
67
|
-
.PHONY: post-release
|
|
68
|
-
|
|
69
|
-
clean: clean-javascript
|
|
70
|
-
.PHONY: clean
|
|
71
|
-
|
|
72
|
-
clean-javascript:
|
|
73
|
-
rm -rf .deps .codegen .tested* coverage dist acceptance
|
|
74
|
-
.PHONY: clean-javascript
|
|
75
|
-
|
|
76
|
-
clobber: clean
|
|
77
|
-
rm -rf node_modules ../../node_modules
|
|
78
|
-
.PHONY: clobber
|
|
79
|
-
|
|
80
|
-
### COMMON stuff for all platforms
|
|
81
|
-
|
|
82
|
-
BERP_VERSION = 1.3.0
|
|
83
|
-
BERP_GRAMMAR = gherkin.berp
|
|
84
|
-
|
|
85
|
-
define berp-generate-parser =
|
|
86
|
-
-! dotnet tool list --tool-path /usr/bin | grep "berp\s*$(BERP_VERSION)" && dotnet tool update Berp --version $(BERP_VERSION) --tool-path /usr/bin
|
|
87
|
-
berp -g $(BERP_GRAMMAR) -t $< -o $@ --noBOM
|
|
88
|
-
endef
|
package/dist/src/cli-main.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli-main.d.ts","sourceRoot":"","sources":["../../src/cli-main.ts"],"names":[],"mappings":""}
|
package/dist/src/cli-main.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const message_streams_1 = require("@cucumber/message-streams");
|
|
7
|
-
const commander_1 = __importDefault(require("commander"));
|
|
8
|
-
const package_json_1 = __importDefault(require("../package.json"));
|
|
9
|
-
const stream_1 = require("stream");
|
|
10
|
-
const CucumberHtmlStream_1 = __importDefault(require("./CucumberHtmlStream"));
|
|
11
|
-
const program = new commander_1.default.Command();
|
|
12
|
-
program.version(package_json_1.default.version);
|
|
13
|
-
program.parse(process.argv);
|
|
14
|
-
const toMessageStream = new message_streams_1.NdjsonToMessageStream();
|
|
15
|
-
stream_1.pipeline(process.stdin, toMessageStream, new CucumberHtmlStream_1.default(__dirname + '/../../dist/main.css', __dirname + '/../../dist/main.js'), process.stdout, (err) => {
|
|
16
|
-
if (err) {
|
|
17
|
-
// tslint:disable-next-line:no-console
|
|
18
|
-
console.error(err);
|
|
19
|
-
process.exit(1);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
//# sourceMappingURL=cli-main.js.map
|
package/dist/src/cli-main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli-main.js","sourceRoot":"","sources":["../../src/cli-main.ts"],"names":[],"mappings":";;;;;AAAA,+DAAiE;AACjE,0DAAiC;AACjC,mEAA+B;AAC/B,mCAAiC;AACjC,8EAAqD;AAErD,MAAM,OAAO,GAAG,IAAI,mBAAS,CAAC,OAAO,EAAE,CAAA;AAEvC,OAAO,CAAC,OAAO,CAAC,sBAAC,CAAC,OAAO,CAAC,CAAA;AAC1B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAE3B,MAAM,eAAe,GAAG,IAAI,uCAAqB,EAAE,CAAA;AACnD,iBAAQ,CACN,OAAO,CAAC,KAAK,EACb,eAAe,EACf,IAAI,4BAAkB,CAAC,SAAS,GAAG,sBAAsB,EAAE,SAAS,GAAG,qBAAqB,CAAC,EAC7F,OAAO,CAAC,MAAM,EACd,CAAC,GAAQ,EAAE,EAAE;IACX,IAAI,GAAG,EAAE;QACP,sCAAsC;QACtC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAChB;AACH,CAAC,CACF,CAAA"}
|