forked from vitest-dev/vitest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: workspace coverage with multiple transforms
- Loading branch information
1 parent
83f4da4
commit f9d095c
Showing
6 changed files
with
116 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { expect, test } from 'vitest' | ||
import run from '../../src/multiple-transforms' | ||
|
||
test('cover space 1 related transforms', () => { | ||
expect(run()).toBe('OK') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { expect, test } from 'vitest' | ||
import run from '../src/multiple-transforms' | ||
|
||
test('cover space 3 related transforms', () => { | ||
expect(run()).toBe('OK') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* eslint-disable spaced-comment, unused-imports/no-unused-vars */ | ||
|
||
export default function run(a = 1, b = 2) { | ||
//! WORKSPACE_1_REMOVE_START | ||
|
||
// In workspace 1 we remove two functions | ||
function removedFunctionOne() { | ||
return 1 | ||
} | ||
function removedFunctionThree() { | ||
return 1 | ||
} | ||
|
||
//! WORKSPACE_1_REMOVE_END | ||
|
||
const unusedFunction1 = () => 1 | ||
const unusedFunction2 = () => a ? b : null | ||
|
||
// Coverage of this branch breaks when combined coverage of workspaces is not handled correctly | ||
if (a === 1000 && b === 1) { | ||
// This should be uncovered | ||
return 1001 | ||
} | ||
|
||
//! WORKSPACE_3_REMOVE_START | ||
|
||
// In workspace 3 we remove three branches | ||
if (a === 100 && b === 1) | ||
return 101 | ||
|
||
if (a === 100 && b === 2) | ||
return 102 | ||
|
||
if (a === 100 && b === 3) | ||
return 103 | ||
|
||
//! WORKSPACE_3_REMOVE_END | ||
|
||
function unusedFunction3() { | ||
return 1 | ||
} | ||
|
||
// Coverage of this branch breaks when combined coverage of workspaces is not handled correctly | ||
if (a === 1000 && b === 2) { | ||
// This should be uncovered | ||
return 1002 | ||
} | ||
|
||
function unusedFunction4() { | ||
return 1 | ||
} | ||
|
||
return 'OK' | ||
} |