提交 56da1b80 编写于 作者: P pissang

test(visual): check store version and run version

上级 6ba93610
......@@ -34,7 +34,8 @@ const {
getRunHash,
getAllTestsRuns,
delTestsRun,
RESULTS_ROOT_DIR
RESULTS_ROOT_DIR,
checkStoreVersion
} = require('./store');
const {prepareEChartsLib, getActionsFullPath} = require('./util');
const fse = require('fs-extra');
......@@ -287,6 +288,10 @@ async function start() {
// TODO Should broadcast to all sockets.
try {
if (!checkStoreVersion(data)) {
throw new Error('Unmatched store version and run version.');
}
await startTests(
data.tests,
io.of('/client'),
......
......@@ -106,6 +106,17 @@ function getResultBaseDir() {
module.exports.getResultBaseDir = getResultBaseDir;
module.exports.getRunHash = getRunHash;
/**
* Check run version is same with store version.
*/
module.exports.checkStoreVersion = function (runParams) {
const storeParams = parseRunHash(_runHash);
console.log('Store ', _runHash);
return storeParams.expectedVersion === runParams.expectedVersion
&& storeParams.actualVersion === runParams.actualVersion
&& storeParams.renderer === runParams.renderer;
}
function getResultFilePath() {
return path.join(getResultBaseDir(), RESULT_FILE_NAME);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册