Skip to content

Commit

Permalink
test(runner): 'only' option
Browse files Browse the repository at this point in the history
  • Loading branch information
ArcherGu committed Jan 10, 2023
1 parent b8dcb1c commit 7546720
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions packages/runner/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,59 @@ describe('Doubleshot Runner', () => {
expect(logs).not.toContain('build backend')
})

it('should only run special name', async () => {
writeConfigFile({
run: [
{
name: 'frontend',
cwd: 'frontend',
commands: {
build: 'npm run build',
},
},
{
name: 'backend',
cwd: 'backend',
commands: {
build: 'npm run build',
},
},
],
only: 'frontend',
})

const logs = await run('build')
expect(logs).toContain('build frontend')
expect(logs).not.toContain('build backend')
})

it('should use "only" config first then "filter" config', async () => {
writeConfigFile({
run: [
{
name: 'frontend',
cwd: 'frontend',
commands: {
build: 'npm run build',
},
},
{
name: 'backend',
cwd: 'backend',
commands: {
build: 'npm run build',
},
},
],
only: 'frontend',
filter: ['frontend', 'backend'],
})

const logs = await run('build')
expect(logs).toContain('build frontend')
expect(logs).not.toContain('build backend')
})

it('should run electron build if "electronBuild" config is set', async () => {
writeConfigFile({
run: [
Expand Down

0 comments on commit 7546720

Please sign in to comment.