@tramvai/test-helpers 1.55.2 → 1.56.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/lib/index.es.js +1 -8
- package/lib/index.js +1 -8
- package/package.json +3 -3
package/lib/index.es.js
CHANGED
|
@@ -17,14 +17,6 @@ const parseHtml = (html, parserOptions = { blockTextElements: { script: false, s
|
|
|
17
17
|
const renderFactory = (request) => async (path, { method = 'get', parserOptions, } = {}) => {
|
|
18
18
|
const response = await request(path, { method });
|
|
19
19
|
const parsed = parseHtml(response.text, parserOptions);
|
|
20
|
-
if (response.status === 500) {
|
|
21
|
-
const pre = parsed.parsed.querySelector('body > pre');
|
|
22
|
-
const [message, ...stack] = pre.innerText.split(' ');
|
|
23
|
-
throw new Error(`Получена ошибка: ${message}
|
|
24
|
-
Проверьте логи сервера в терминале для подробностей об ошибке
|
|
25
|
-
Cтек ошибки: ${stack.join('\n\t')}
|
|
26
|
-
`);
|
|
27
|
-
}
|
|
28
20
|
return {
|
|
29
21
|
...parsed,
|
|
30
22
|
get initialState() {
|
|
@@ -35,6 +27,7 @@ Cтек ошибки: ${stack.join('\n\t')}
|
|
|
35
27
|
return JSON.parse(script.innerHTML
|
|
36
28
|
.replace("var initialState = '", '')
|
|
37
29
|
.replace(/'$/, '')
|
|
30
|
+
.replace(/'/g, "\\\\'")
|
|
38
31
|
.replace(/\\\\/g, '\\'));
|
|
39
32
|
}
|
|
40
33
|
}
|
package/lib/index.js
CHANGED
|
@@ -25,14 +25,6 @@ const parseHtml = (html, parserOptions = { blockTextElements: { script: false, s
|
|
|
25
25
|
const renderFactory = (request) => async (path, { method = 'get', parserOptions, } = {}) => {
|
|
26
26
|
const response = await request(path, { method });
|
|
27
27
|
const parsed = parseHtml(response.text, parserOptions);
|
|
28
|
-
if (response.status === 500) {
|
|
29
|
-
const pre = parsed.parsed.querySelector('body > pre');
|
|
30
|
-
const [message, ...stack] = pre.innerText.split(' ');
|
|
31
|
-
throw new Error(`Получена ошибка: ${message}
|
|
32
|
-
Проверьте логи сервера в терминале для подробностей об ошибке
|
|
33
|
-
Cтек ошибки: ${stack.join('\n\t')}
|
|
34
|
-
`);
|
|
35
|
-
}
|
|
36
28
|
return {
|
|
37
29
|
...parsed,
|
|
38
30
|
get initialState() {
|
|
@@ -43,6 +35,7 @@ Cтек ошибки: ${stack.join('\n\t')}
|
|
|
43
35
|
return JSON.parse(script.innerHTML
|
|
44
36
|
.replace("var initialState = '", '')
|
|
45
37
|
.replace(/'$/, '')
|
|
38
|
+
.replace(/'/g, "\\\\'")
|
|
46
39
|
.replace(/\\\\/g, '\\'));
|
|
47
40
|
}
|
|
48
41
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/test-helpers",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.56.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"build-for-publish": "true"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@tramvai/core": "1.
|
|
22
|
-
"@tramvai/test-mocks": "1.
|
|
21
|
+
"@tramvai/core": "1.56.0",
|
|
22
|
+
"@tramvai/test-mocks": "1.56.0",
|
|
23
23
|
"@types/express": "^4.17.1",
|
|
24
24
|
"@types/supertest": "^2.0.11",
|
|
25
25
|
"express": "^4.17.1",
|