mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
[#66563] Configure Vitest
Wire the frontend test target to Vitest and add shared setup for Angular specs under esbuild. https://community.openproject.org/wp/66563
This commit is contained in:
+5
-12
@@ -146,20 +146,13 @@
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"builder": "@angular/build:unit-test",
|
||||
"options": {
|
||||
"preserveSymlinks": true,
|
||||
"main": "src/test.ts",
|
||||
"karmaConfig": "./karma.conf.js",
|
||||
"tsConfig": "tsconfig.spec.json",
|
||||
"scripts": [],
|
||||
"styles": [],
|
||||
"stylePreprocessorOptions": {
|
||||
"includePaths": [
|
||||
"src/assets/sass/"
|
||||
]
|
||||
},
|
||||
"assets": []
|
||||
"buildTarget": "::development",
|
||||
"runner": "vitest",
|
||||
"providersFile": "src/test-providers.ts",
|
||||
"setupFiles": ["src/test-setup.ts"]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
|
||||
@@ -68,4 +68,17 @@ function generatePluginModule(plugins) {
|
||||
fs.writeFileSync(fileRegister, result);
|
||||
};
|
||||
|
||||
function generatePluginStyles(plugins) {
|
||||
const fileRegister = path.join(railsRoot, 'frontend/src/app/features/plugins/linked-plugins.styles.sass');
|
||||
console.log(`Regenerating frontend plugin sass ${fileRegister}.`);
|
||||
|
||||
const imports = plugins
|
||||
.filter(([, pluginPath]) => fs.existsSync(path.join(pluginPath, 'frontend', 'module', 'global_styles')))
|
||||
.map(([name]) => `@import "./linked/${name}/global_styles"`)
|
||||
.join('\n');
|
||||
|
||||
fs.writeFileSync(fileRegister, `// Generated by ci-plugins-generator.js\n${imports}\n`);
|
||||
};
|
||||
|
||||
generatePluginModule(allFrontendPlugins);
|
||||
generatePluginStyles(allFrontendPlugins);
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import { provideZonelessChangeDetection } from '@angular/core';
|
||||
|
||||
export default [
|
||||
provideZonelessChangeDetection(),
|
||||
];
|
||||
@@ -0,0 +1,9 @@
|
||||
import { I18n } from 'i18n-js';
|
||||
import { registerDialogStreamAction } from 'core-turbo/dialog-stream-action';
|
||||
|
||||
registerDialogStreamAction();
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
||||
(window as any).global = window;
|
||||
|
||||
window.I18n = new I18n();
|
||||
@@ -3,11 +3,11 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine"
|
||||
]
|
||||
"vitest/globals"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/test.ts",
|
||||
"src/test-setup.ts",
|
||||
"src/polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
|
||||
Reference in New Issue
Block a user