Skip to content

Commit

Permalink
fix: set import.meta.vitest=false
Browse files Browse the repository at this point in the history
solufa committed Jun 8, 2024
1 parent cae7037 commit 97e7c10
Showing 6 changed files with 10 additions and 13 deletions.
5 changes: 1 addition & 4 deletions client/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';

export default defineConfig({
define: { 'import.meta.vitest': false },
plugins: [tsconfigPaths()],
test: {
exclude: ['node_modules', 'server', 'out'],
exclude: ['node_modules', 'out', 'api'],
},
});
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions server/scripts/build.dev.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { context } = require('esbuild');
const config = require('./config.common');

context({ ...config, define: { 'process.env.NODE_ENV': `"development"` } }).then((ctx) =>
ctx.watch(),
);
context({
...config,
define: { 'process.env.NODE_ENV': `"development"`, 'import.meta.vitest': 'false' },
}).then((ctx) => ctx.watch());
2 changes: 1 addition & 1 deletion server/scripts/build.prod.js
Original file line number Diff line number Diff line change
@@ -5,5 +5,5 @@ build({
...config,
minify: true,
sourcemap: 'linked',
define: { 'process.env.NODE_ENV': `"production"` },
define: { 'process.env.NODE_ENV': `"production"`, 'import.meta.vitest': 'false' },
}).catch(() => process.exit(1));
2 changes: 1 addition & 1 deletion server/service/app.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import server from '$server';
import cookie from '@fastify/cookie';
import helmet from '@fastify/helmet';
import fastifyStatic from '@fastify/static';
import type { FastifyInstance, FastifyServerFactory } from 'fastify';
import Fastify from 'fastify';
import { join } from 'path';
import { API_BASE_PATH } from 'service/envValues';
import server from '../$server';

export const init = (serverFactory?: FastifyServerFactory): FastifyInstance => {
const fastify = Fastify({ serverFactory, ignoreTrailingSlash: true });
1 change: 0 additions & 1 deletion server/vite.config.ts
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@ import tsconfigPaths from 'vite-tsconfig-paths';
dotenv.config();

export default defineConfig({
define: { 'import.meta.vitest': false },
plugins: [tsconfigPaths()],
test: {
env: { DATABASE_URL: process.env.TEST_DATABASE_URL ?? '' },

0 comments on commit 97e7c10

Please sign in to comment.