@cucumber/html-formatter 21.4.0 → 21.6.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/src/index.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { CucumberHtmlStream } from './CucumberHtmlStream'
2
+
3
+ export * from './CucumberHtmlStream'
4
+
5
+ /**
6
+ * @deprecated use the named export `CucumberHtmlStream` instead
7
+ */
8
+ export default CucumberHtmlStream
@@ -2,7 +2,7 @@ import * as messages from '@cucumber/messages'
2
2
  import assert from 'assert'
3
3
  import { Writable } from 'stream'
4
4
 
5
- import CucumberHtmlStream from '../src/CucumberHtmlStream'
5
+ import { CucumberHtmlStream } from '../src'
6
6
 
7
7
  async function renderAsHtml(
8
8
  ...envelopes: messages.Envelope[]
@@ -73,4 +73,26 @@ describe('CucumberHtmlStream', () => {
73
73
  ) >= 0
74
74
  )
75
75
  })
76
+
77
+ it('escapes forward slashes', async () => {
78
+ const e1: messages.Envelope = {
79
+ gherkinDocument: {
80
+ comments: [
81
+ {
82
+ location: {
83
+ line: 0,
84
+ column: 0,
85
+ },
86
+ text: `</script><script>alert('Hello')</script>`,
87
+ },
88
+ ],
89
+ },
90
+ }
91
+ const html = await renderAsHtml(e1)
92
+ assert(
93
+ html.indexOf(
94
+ `window.CUCUMBER_MESSAGES = [{"gherkinDocument":{"comments":[{"location":{"line":0,"column":0},"text":"<\\/script><script>alert('Hello')<\\/script>"}]}}];`
95
+ ) >= 0
96
+ )
97
+ })
76
98
  })
@@ -6,7 +6,7 @@ import path from 'path'
6
6
  import puppeteer from 'puppeteer'
7
7
  import { PassThrough, pipeline } from 'stream'
8
8
 
9
- import CucumberHtmlStream from '../src/CucumberHtmlStream'
9
+ import { CucumberHtmlStream } from '../src'
10
10
 
11
11
  async function canRenderHtml(html: string): Promise<boolean> {
12
12
  const browser = await puppeteer.launch({