test: refactor template
This commit is contained in:
parent
3b05e4004b
commit
1550aca267
|
@ -1,5 +1,5 @@
|
|||
import {cp} from 'fs/promises';
|
||||
import {join} from 'path';
|
||||
import {join, resolve} from 'path';
|
||||
|
||||
import {createWorkspace} from '@flecks/core/build/testing';
|
||||
|
||||
|
@ -7,10 +7,10 @@ const {
|
|||
FLECKS_CORE_ROOT = process.cwd(),
|
||||
} = process.env;
|
||||
|
||||
export const templateDefaultPath = join(FLECKS_CORE_ROOT, 'test', 'template');
|
||||
export const templateDefaultPath = 'template';
|
||||
|
||||
export async function createApplication(template = templateDefaultPath) {
|
||||
const workspace = await createWorkspace();
|
||||
await cp(template, workspace, {recursive: true});
|
||||
await cp(resolve(join(FLECKS_CORE_ROOT, 'test'), template), workspace, {recursive: true});
|
||||
return workspace;
|
||||
}
|
||||
|
|
|
@ -116,6 +116,7 @@ export async function startServer({
|
|||
opts = {},
|
||||
path: request,
|
||||
task,
|
||||
template,
|
||||
} = {}) {
|
||||
let previousTimeout;
|
||||
const start = Date.now();
|
||||
|
@ -124,7 +125,7 @@ export async function startServer({
|
|||
task.timeout(0);
|
||||
}
|
||||
const {socketPath, socketServer} = await socketListener();
|
||||
const path = request || await createApplication();
|
||||
const path = request || await createApplication(template);
|
||||
if (beforeBuild) {
|
||||
await beforeBuild({path, task});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user