e2e-test: add versionQuery template helper

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-09-23 22:28:56 +02:00
parent 23e336257f
commit e7ac4b406c
+10
View File
@@ -127,6 +127,16 @@ async function buildDistWorkspace(workspaceName: string, rootDir: string) {
}
return pkge.version;
},
versionQuery(name: string, hint: string) {
const pkgData = require(`${name}/package.json`);
if (!pkgData) {
if (typeof hint !== 'string') {
throw new Error(`No version available for package ${name}`);
}
return `^${hint}`;
}
return `^${pkgData.version}`;
},
},
},
),