Forráskód Böngészése

chore(dashboard): Fix failing test config

Michael Bromley 8 hónapja
szülő
commit
225d6c1022

+ 7 - 1
packages/dashboard/vite.config.mts

@@ -21,6 +21,12 @@ export default ({ mode }: { mode: string }) => {
         isLocalDev: process.env.IS_LOCAL_DEV,
     });
 
+    const vendureConfigPath = process.env.VITEST ?
+        // This should always be used for running the tests
+        './sample-vendure-config.ts'
+        // This one might be changed to '../dev-server/dev-config.ts' to test ui extensions
+        : './sample-vendure-config.ts';
+
     return defineConfig({
         test: {
             globals: true,
@@ -28,7 +34,7 @@ export default ({ mode }: { mode: string }) => {
         },
         plugins: [
             vendureDashboardPlugin({
-                vendureConfigPath: pathToFileURL('../dev-server/dev-config.ts'),
+                vendureConfigPath: pathToFileURL(vendureConfigPath),
                 adminUiConfig: { apiHost: adminApiHost, apiPort: adminApiPort },
                 // gqlTadaOutputPath: path.resolve(__dirname, './graphql/'),
                 tempCompilationDir: path.resolve(__dirname, './.temp'),

+ 4 - 2
packages/dashboard/vite/utils/config-loader.ts

@@ -389,7 +389,8 @@ function reportDiagnostics(program: ts.Program, emitResult: ts.EmitResult, logge
             const { line, character } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
             const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
             const logFn = diagnostic.category === ts.DiagnosticCategory.Error ? logger.warn : logger.info;
-            logFn(
+            // eslint-disable-next-line no-console
+            console.log(
                 `TS${diagnostic.code} ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`,
             );
             if (diagnostic.category === ts.DiagnosticCategory.Error) {
@@ -398,7 +399,8 @@ function reportDiagnostics(program: ts.Program, emitResult: ts.EmitResult, logge
         } else {
             const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
             const logFn = diagnostic.category === ts.DiagnosticCategory.Error ? logger.warn : logger.info;
-            logFn(`TS${diagnostic.code}: ${message}`);
+            // eslint-disable-next-line no-console
+            console.log(`TS${diagnostic.code}: ${message}`);
             if (diagnostic.category === ts.DiagnosticCategory.Error) {
                 hasEmitErrors = true;
             }