-
Notifications
You must be signed in to change notification settings - Fork 16
test: introduce test-vitest-setup #1067
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
base: main
Are you sure you want to change the base?
Conversation
@code-pushup/create-cli
@code-pushup/ci
@code-pushup/models
@code-pushup/nx-plugin
@code-pushup/cli
@code-pushup/coverage-plugin
@code-pushup/core
@code-pushup/eslint-plugin
@code-pushup/js-packages-plugin
@code-pushup/jsdocs-plugin
@code-pushup/lighthouse-plugin
@code-pushup/typescript-plugin
@code-pushup/utils
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for starting this refactor! Looking forward to a clean test config setup.
Some remarks, If you open a PR and request a review please do a self review.
Check if:
- all changes are applied in a consistent way. Not different versions for the same change. E.g. you extend the global configuration in different ways.
- do not add code changes out of scope. If they are necessary mention them in a comment
- potentially add information on the state of the PR e.g.
DO NOT REFIEW
and additional comments about unfinished parts. - If you use AI do an extra detailed review!
View your CI Pipeline Execution ↗ for commit 3551706
☁️ Nx Cloud last updated this comment at |
type CoverageConfig = { | ||
enabled?: boolean; | ||
provider: 'v8'; | ||
reporter: ('text' | 'lcov')[]; | ||
reportsDirectory: string; | ||
include: string[]; | ||
exclude: string[]; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use the types from vite/vitest directly:
// from vite
import type { UserConfig } from 'vite';
type TestCoverage = Exclude<UserConfig['test'], undefined>;
// from vitest
import type { UserConfig } from 'vitest';
type TestCoverage = UserConfig;
// for both
const testConfig: TestCoverage = {
coverage: {
reporter: ['text', 'lcov'],
reportsDirectory: '../../coverage/plugin-eslint/int-tests',
exclude: ['mocks/**', '**/types.ts'],
},
};
I suggest go with types from vitest
and remove the types in this file.
@@ -14,7 +15,7 @@ export function tsconfigPathAliases(): AliasOptions { | |||
.map( | |||
([importPath, relativePath]): Alias => ({ | |||
find: importPath, | |||
replacement: new URL(`../${relativePath}`, import.meta.url).pathname, | |||
replacement: path.resolve(relativePath), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change needed? I think we can revert it. Was there a problem?
import baseConfig from '../../eslint.config.js'; | ||
|
||
export default [ | ||
...baseConfig, | ||
{ | ||
files: ['**/*'], | ||
}, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be the same as in test-setup
?
import tseslint from 'typescript-eslint';
import baseConfig from '../../eslint.config.js';
export default tseslint.config(...baseConfig, {
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
});
Closes #1065