Fix runtime loading
All checks were successful
timw4mail/scroll/pipeline/head This commit looks good
All checks were successful
timw4mail/scroll/pipeline/head This commit looks good
This commit is contained in:
parent
32f9ef3bba
commit
82bcc72d21
@ -30,7 +30,7 @@ let scrollRuntime: IRuntime | null = null;
|
|||||||
|
|
||||||
export function log(s: unknown, level: LogLevel = LogLevel.Notice): void {
|
export function log(s: unknown, level: LogLevel = LogLevel.Notice): void {
|
||||||
getRuntime().then(({ file }) => {
|
getRuntime().then(({ file }) => {
|
||||||
const raw = typeof s === 'string' ? s : JSON.stringify(s, null, 2);
|
const raw = JSON.stringify(s, null, 2);
|
||||||
const output = `${level}: ${raw}\n`;
|
const output = `${level}: ${raw}\n`;
|
||||||
|
|
||||||
const outputFile = (level === LogLevel.Error)
|
const outputFile = (level === LogLevel.Error)
|
||||||
@ -85,15 +85,18 @@ export async function getRuntime(): Promise<IRuntime> {
|
|||||||
const pkg = await import(path);
|
const pkg = await import(path);
|
||||||
if ('default' in pkg) {
|
if ('default' in pkg) {
|
||||||
scrollRuntime = pkg.default;
|
scrollRuntime = pkg.default;
|
||||||
|
}
|
||||||
|
|
||||||
if (scrollRuntime !== null) {
|
if (scrollRuntime !== null) {
|
||||||
return Promise.resolve(scrollRuntime);
|
return Promise.resolve(scrollRuntime);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.reject('Missing default import');
|
return Promise.reject('Missing default import');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Promise.resolve(scrollRuntime);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the common test interface object
|
* Get the common test interface object
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user