File size: 1,075 Bytes
466436b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
502af73
466436b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { defineConfig, Plugin } from 'vitest/config'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath } from 'node:url'

// Plugin to handle /lib/tgnParser.cjs imports in Node.js environment
const libParserPlugin: Plugin = {
  name: 'lib-parser-bypass',
  enforce: 'pre',
  transform(code, id) {
    // Only transform parserInit.ts
    if (id.includes('parserInit')) {
      // Replace import calls of /lib/tgnParser.cjs with a marker that won't be analyzed
      return code.replace(
        /await import\(.*?\/lib\/tgnParser\.cjs/g,
        'await import("" + "/lib/tgnParser.cjs'
      )
    }
  }
}

export default defineConfig({
  plugins: [libParserPlugin, vue()],
  test: {
    globals: true,
    environment: 'node', // Changed from jsdom to node since we're testing pure logic
    include: ['tests/**/*.test.ts'], // All tests
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./app/src', import.meta.url)),
      '@inc': fileURLToPath(new URL('./inc', import.meta.url))
    }
  },
  ssr: {
    external: ['/lib/tgnParser.cjs']
  }
})