| 1 | import jison from './.vite/jisonPlugin.js'; |
| 2 | import jsonSchemaPlugin from './.vite/jsonSchemaPlugin.js'; |
| 3 | import typescript from '@rollup/plugin-typescript'; |
| 4 | import { defaultExclude, defineConfig } from 'vitest/config'; |
| 5 | |
| 6 | export default defineConfig({ |
| 7 | resolve: { |
| 8 | extensions: ['.js'], |
| 9 | }, |
| 10 | plugins: [ |
| 11 | jison(), |
| 12 | jsonSchemaPlugin(), // handles .schema.yaml JSON Schema files |
| 13 | typescript({ compilerOptions: { declaration: false } }), |
| 14 | ], |
| 15 | test: { |
| 16 | environment: 'jsdom', |
| 17 | globals: true, |
| 18 | // TODO: should we move this to a mermaid-core package? |
| 19 | coverage: { |
| 20 | provider: 'v8', |
| 21 | reporter: ['text', 'json', 'html', 'lcov'], |
| 22 | reportsDirectory: './coverage/vitest', |
| 23 | exclude: [...defaultExclude, './tests/**', '**/__mocks__/**', '**/generated/'], |
| 24 | }, |
| 25 | includeSource: ['packages/*/src/**/*.{js,ts}'], |
| 26 | clearMocks: true, |
| 27 | }, |
| 28 | build: { |
| 29 | /** If you set esmExternals to true, this plugins assumes that |
| 30 | all external dependencies are ES modules */ |
| 31 | |
| 32 | commonjsOptions: { |
| 33 | esmExternals: true, |
| 34 | }, |
| 35 | }, |
| 36 | define: { |
| 37 | // Needs to be string |
| 38 | 'injected.includeLargeFeatures': 'true', |
| 39 | 'import.meta.vitest': 'undefined', |
| 40 | packageVersion: "'0.0.0'", |
| 41 | }, |
| 42 | }); |
| 43 | |