refactor: test workspace
This commit is contained in:
parent
c416e6b23f
commit
870c1a95dc
|
@ -1,6 +1,7 @@
|
|||
import {mkdir} from 'fs/promises';
|
||||
import {join} from 'path';
|
||||
|
||||
import {createWorkspace} from '@flecks/core/build/testing';
|
||||
import {pipesink, processCode, spawnWith} from '@flecks/core/server';
|
||||
import {expect} from 'chai';
|
||||
|
||||
|
@ -9,18 +10,12 @@ const {
|
|||
} = process.env;
|
||||
|
||||
it('fails if destination already exists', async () => {
|
||||
const cacheLocation = join(
|
||||
FLECKS_CORE_ROOT,
|
||||
'node_modules',
|
||||
'.cache',
|
||||
'@flecks',
|
||||
'create-app',
|
||||
);
|
||||
await mkdir(join(cacheLocation, 'failure'), {recursive: true});
|
||||
const workspace = await createWorkspace();
|
||||
await mkdir(join(workspace, 'failure'), {recursive: true});
|
||||
const child = spawnWith(
|
||||
[join(FLECKS_CORE_ROOT, 'build', 'cli.js'), 'failure'],
|
||||
{
|
||||
env: {FLECKS_CORE_ROOT: cacheLocation},
|
||||
env: {FLECKS_CORE_ROOT: workspace},
|
||||
stdio: 'pipe',
|
||||
},
|
||||
);
|
||||
|
@ -28,5 +23,5 @@ it('fails if destination already exists', async () => {
|
|||
expect(await processCode(child))
|
||||
.to.equal(1);
|
||||
expect(buffer.toString())
|
||||
.to.contain(`destination '${join(cacheLocation, 'failure')}' already exists`);
|
||||
.to.contain(`destination '${join(workspace, 'failure')}' already exists`);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user