html-reporter 7.3.1 → 7.4.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/CHANGELOG.md +13 -0
- package/README.md +43 -8
- package/lib/common-utils.js +13 -14
- package/lib/constants/extension-points.js +1 -0
- package/lib/constants/plugin-events.js +10 -0
- package/lib/gui/server.js +1 -4
- package/lib/gui/tool-runner/index.js +4 -2
- package/lib/gui/tool-runner/utils.js +4 -20
- package/lib/plugin-api.js +14 -1
- package/lib/report-builder/static.js +1 -0
- package/lib/sqlite-adapter.js +4 -1
- package/lib/static/components/gui.js +10 -1
- package/lib/static/components/report.js +6 -1
- package/lib/static/components/section/body/result.js +5 -1
- package/lib/static/gui.html +1 -1
- package/lib/static/gui.min.js +12 -12
- package/lib/static/modules/action-names.js +1 -0
- package/lib/static/modules/actions.js +7 -2
- package/lib/static/modules/reducers/db.js +4 -2
- package/lib/static/modules/sqlite.js +20 -15
- package/lib/static/report.min.js +12 -12
- package/package.json +4 -4
- package/webpack.common.js +5 -0
- package/lib/static/0.min.js +0 -16
- package/lib/static/2.min.js +0 -16
- package/sqlite.db +0 -0
|
@@ -5,8 +5,9 @@ import StaticTestsTreeBuilder from '../../tests-tree-builder/static';
|
|
|
5
5
|
import actionNames from './action-names';
|
|
6
6
|
import {types as modalTypes} from '../components/modals';
|
|
7
7
|
import {QUEUED} from '../../constants/test-statuses';
|
|
8
|
+
import {LOCAL_DATABASE_NAME} from '../../constants/file-names';
|
|
8
9
|
import {getHttpErrorMessage} from './utils';
|
|
9
|
-
import {fetchDatabases, mergeDatabases} from './sqlite';
|
|
10
|
+
import {fetchDatabases, mergeDatabases, connectToDatabase} from './sqlite';
|
|
10
11
|
import {getSuitesTableRows} from './database-utils';
|
|
11
12
|
import {setFilteredBrowsers} from './query-params';
|
|
12
13
|
import plugins from './plugins';
|
|
@@ -22,11 +23,14 @@ export const initGuiReport = () => {
|
|
|
22
23
|
try {
|
|
23
24
|
const appState = await axios.get('/init');
|
|
24
25
|
|
|
26
|
+
const mainDatabaseUrl = new URL(LOCAL_DATABASE_NAME, window.location.href);
|
|
27
|
+
const db = await connectToDatabase(mainDatabaseUrl.href);
|
|
28
|
+
|
|
25
29
|
await plugins.loadAll(appState.data.config);
|
|
26
30
|
|
|
27
31
|
dispatch({
|
|
28
32
|
type: actionNames.INIT_GUI_REPORT,
|
|
29
|
-
payload: appState.data
|
|
33
|
+
payload: {...appState.data, db}
|
|
30
34
|
});
|
|
31
35
|
|
|
32
36
|
const {customGuiError} = appState.data;
|
|
@@ -80,6 +84,7 @@ export const initStaticReport = () => {
|
|
|
80
84
|
};
|
|
81
85
|
};
|
|
82
86
|
|
|
87
|
+
export const finGuiReport = () => ({type: actionNames.FIN_GUI_REPORT});
|
|
83
88
|
export const finStaticReport = () => ({type: actionNames.FIN_STATIC_REPORT});
|
|
84
89
|
|
|
85
90
|
const runTests = ({tests = [], action = {}} = {}) => {
|
|
@@ -3,12 +3,14 @@ import actionNames from '../action-names';
|
|
|
3
3
|
|
|
4
4
|
export default (state, action) => {
|
|
5
5
|
switch (action.type) {
|
|
6
|
-
case actionNames.INIT_STATIC_REPORT:
|
|
6
|
+
case actionNames.INIT_STATIC_REPORT:
|
|
7
|
+
case actionNames.INIT_GUI_REPORT: {
|
|
7
8
|
const {db} = action.payload;
|
|
8
9
|
return {...state, db};
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
case actionNames.FIN_STATIC_REPORT:
|
|
12
|
+
case actionNames.FIN_STATIC_REPORT:
|
|
13
|
+
case actionNames.FIN_GUI_REPORT: {
|
|
12
14
|
closeDatabase(state.db);
|
|
13
15
|
|
|
14
16
|
return state;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import {flattenDeep} from 'lodash';
|
|
5
|
-
import {
|
|
5
|
+
import {mergeTables} from '../../common-utils';
|
|
6
6
|
|
|
7
7
|
function isRelativeUrl(url) {
|
|
8
8
|
try {
|
|
@@ -114,28 +114,33 @@ async function mergeDatabases(dataForDbs) {
|
|
|
114
114
|
const mergedDbConnection = new SQL.Database(undefined, sumOfChunkSizes);
|
|
115
115
|
const dbPaths = connections.map(db => db.filename);
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
mergedDbConnection.run(query);
|
|
120
|
-
} catch (err) {
|
|
121
|
-
// TODO: To be able to work with files that have been created before
|
|
122
|
-
// TODO: Remove in next versions
|
|
123
|
-
if (/no such table/.test(err)) {
|
|
124
|
-
console.warn(err);
|
|
125
|
-
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
117
|
+
mergeTables({db: mergedDbConnection, dbPaths, getExistingTables: (statement) => {
|
|
118
|
+
const tables = [];
|
|
128
119
|
|
|
129
|
-
|
|
120
|
+
while (statement.step()) {
|
|
121
|
+
tables.push(...statement.get());
|
|
130
122
|
}
|
|
131
|
-
|
|
123
|
+
|
|
124
|
+
return tables;
|
|
125
|
+
}});
|
|
132
126
|
|
|
133
127
|
connections.forEach(db => db.close());
|
|
134
128
|
|
|
135
129
|
return mergedDbConnection;
|
|
136
130
|
}
|
|
137
131
|
|
|
132
|
+
async function connectToDatabase(dbUrl) {
|
|
133
|
+
const mainDatabaseUrl = new URL(dbUrl);
|
|
134
|
+
const {data} = await fetchFile(mainDatabaseUrl.href, {
|
|
135
|
+
responseType: 'arraybuffer'
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const SQL = await window.initSqlJs();
|
|
139
|
+
return new SQL.Database(new Uint8Array(data));
|
|
140
|
+
}
|
|
141
|
+
|
|
138
142
|
module.exports = {
|
|
139
143
|
fetchDatabases,
|
|
140
|
-
mergeDatabases
|
|
144
|
+
mergeDatabases,
|
|
145
|
+
connectToDatabase
|
|
141
146
|
};
|