Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/vitest #4043

Merged
merged 49 commits into from
May 20, 2023
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
1a6b4f4
VitestTestRunner dryRun implementation
odinvanderlinden Feb 17, 2023
2f7fd8e
mutantRun implementaion
odinvanderlinden Feb 24, 2023
2b9eb2f
implemented hit limit + added integration test and unit tests + imple…
odinvanderlinden Mar 18, 2023
56562c1
test filter + tests
odinvanderlinden Mar 30, 2023
163d9f5
Update stryker versions
nicojs Mar 31, 2023
45ae5d0
test(e2e): Move math to src dir (stryker didnt mutate)
nicojs Mar 31, 2023
04c3d72
add snapshot verify
nicojs Mar 31, 2023
c976e81
Move vitest to a dev dependency (instead of dependency)
nicojs Mar 31, 2023
3e40ecd
Commit the snapshot file
nicojs Mar 31, 2023
fb2fbda
Fix some bugs in the vitest runner:
nicojs Mar 31, 2023
6f8eeef
Make global namespace file work the same way as other file communicat…
nicojs Apr 1, 2023
2a64700
.
nicojs Apr 1, 2023
5b45ca2
Implemented file-communicator class
odinvanderlinden Apr 11, 2023
1fa2346
rename of test file
odinvanderlinden Apr 11, 2023
4909c95
Merge remote-tracking branch 'origin/master' into feat/vitest
odinvanderlinden Apr 25, 2023
52d2acb
correct stryker test helper version
odinvanderlinden Apr 28, 2023
8a619f5
windows path fix
odinvanderlinden Apr 28, 2023
c7eaa36
updated e2e test vitest-noconfig
odinvanderlinden Apr 28, 2023
f2b15ee
Merge remote-tracking branch 'origin/master' into feat/vitest
odinvanderlinden Apr 28, 2023
7ee548f
vitest no config olders working version e2e test
odinvanderlinden Apr 28, 2023
6e1dc7a
correct vitest package lock
odinvanderlinden Apr 28, 2023
f2864c9
revert vitest to 0.29.8
odinvanderlinden Apr 28, 2023
040fbc8
ctx.close to maby resolve lock error
odinvanderlinden Apr 28, 2023
446934f
Add `exit` on `VitestRunner.dispose()`. It should stop the vitest wor…
nicojs May 4, 2023
6401669
Fix Lint warning
nicojs May 4, 2023
1a85c7a
Simplify `FileCommunicator`
nicojs May 4, 2023
5fc7459
Add retry clean tmp dir
nicojs May 4, 2023
25833c3
Merge remote-tracking branch 'origin/master' into feat/vitest
danny12321 May 12, 2023
5200829
Fix import
danny12321 May 12, 2023
d8d4f61
Added integration test to stryker run
danny12321 May 12, 2023
82620e5
Added FileCommunicator tests
danny12321 May 12, 2023
7d4603b
Reverted changes from not vitest related folders
danny12321 May 12, 2023
1761783
Updated vitest e2e snapshots
danny12321 May 12, 2023
5465752
Added option to reference config file
danny12321 May 12, 2023
f0fa1e1
Update packages/vitest-runner/schema/vitest-runner-options.json
nicojs May 13, 2023
809c9d6
Rename `vitest.config` -> `vitest.configFile` and other refactorings
nicojs May 14, 2023
b8e5c81
test(file-communicator): migrate from integration to unit tests
nicojs May 15, 2023
396b075
Fix mutation test
nicojs May 15, 2023
3ec0563
Use full file path in test id
nicojs May 15, 2023
d1f552b
Support vitest workspaces
nicojs May 18, 2023
316255b
Workaround for hooks not working
nicojs May 19, 2023
5b0cd08
Merge branch 'master' into feat/vitest
nicojs May 19, 2023
aa12dc1
Implement the cache busting workaround
nicojs May 20, 2023
77bd659
Fix lint
nicojs May 20, 2023
8a4acc8
Normalize line endings on windows
nicojs May 20, 2023
52c9717
modernize e2e test
nicojs May 20, 2023
49b9e7b
fix lint
nicojs May 20, 2023
1ccd4b6
Add to schema validation e2e test
nicojs May 20, 2023
7371c54
Fix final test with file name normalization
nicojs May 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,695 changes: 1,659 additions & 36 deletions e2e/package-lock.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"ts-jest": "29.0.5",
"ts-loader": "9.4.2",
"ts-node": "10.9.1",
"vitest": "0.31.1",
"typescript": "5.0.4",
"webpack": "5.83.1",
"webpack-cli": "5.1.1"
Expand All @@ -68,6 +69,7 @@
"@stryker-mutator/cucumber-runner": "../packages/cucumber-runner",
"@stryker-mutator/util": "../packages/util",
"@stryker-mutator/tap-runner": "../packages/tap-runner",
"@stryker-mutator/typescript-checker": "../packages/typescript-checker"
"@stryker-mutator/typescript-checker": "../packages/typescript-checker",
"@stryker-mutator/vitest-runner": "../packages/vitest-runner"
}
}
15 changes: 15 additions & 0 deletions e2e/test/vitest-noconfig/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "vitest-noconfig",
"version": "0.0.0",
"private": true,
"description": "A module to perform an integration test",
"main": "index.js",
"scripts": {
"pretest": "rimraf \"reports\"",
"test": "stryker run",
"posttest": "mocha --no-config --no-package --timeout 0 verify/verify.js",
"test:unit": "vitest run"
},
"author": "",
"license": "ISC"
}
20 changes: 20 additions & 0 deletions e2e/test/vitest-noconfig/src/math.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export function add(num1: number, num2: number) {
return num1 + num2;
}

export function addOne(number: number) {
number++;
return number;
}

export function negate(number: number) {
return -number;
}

export function isNegativeNumber(number: number) {
var isNegative = false;
if (number < 0) {
isNegative = true;
}
return isNegative;
}
10 changes: 10 additions & 0 deletions e2e/test/vitest-noconfig/stryker.conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "../../node_modules/@stryker-mutator/core/schema/stryker-schema.json",
"testRunner": "vitest",
"concurrency": 1,
"coverageAnalysis": "perTest",
"reporters": ["json", "clear-text", "html", "event-recorder"],
"plugins": [
"@stryker-mutator/vitest-runner"
]
}
40 changes: 40 additions & 0 deletions e2e/test/vitest-noconfig/tests/math.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { add, addOne, isNegativeNumber, negate } from '../src/math';
import { expect, test, describe } from 'vitest';

describe('math', () => {
test('should be able to add two numbers', function () {
var num1 = 2;
var num2 = 5;
var expected = num1 + num2;

var actual = add(num1, num2);

expect(actual).toBe(expected);
});

test('should be able to add one to a number', function () {
var number = 2;
var expected = 3;

var actual = addOne(number);

expect(actual).toBe(expected);
});

test('should be able negate a number', function () {
var number = 2;
var expected = -2;

var actual = negate(number);

expect(actual).toBe(expected);
});

test('should be able to recognize a negative number', function () {
var number = -2;

var isNegative = isNegativeNumber(number);

expect(isNegative).toBe(true);
});
});
3 changes: 3 additions & 0 deletions e2e/test/vitest-noconfig/verify/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
7 changes: 7 additions & 0 deletions e2e/test/vitest-noconfig/verify/verify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { expectMetricsJsonToMatchSnapshot } from '../../../helpers.js';

describe('Verify stryker has ran correctly', () => {
it('should report correct score', async () => {
await expectMetricsJsonToMatchSnapshot();
});
});
22 changes: 22 additions & 0 deletions e2e/test/vitest-noconfig/verify/verify.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Verify stryker has ran correctly should report correct score 1`] = `
Object {
"compileErrors": 0,
"ignored": 0,
"killed": 11,
"mutationScore": 78.57142857142857,
"mutationScoreBasedOnCoveredCode": 78.57142857142857,
"noCoverage": 0,
"pending": 0,
"runtimeErrors": 0,
"survived": 3,
"timeout": 0,
"totalCovered": 14,
"totalDetected": 11,
"totalInvalid": 0,
"totalMutants": 14,
"totalUndetected": 3,
"totalValid": 14,
}
`;
Loading