test(web-app): add cypress for unit test
This commit is contained in:
40
web-app/cypress.unit.js
Normal file
40
web-app/cypress.unit.js
Normal file
@@ -0,0 +1,40 @@
|
||||
const { defineConfig } = require('cypress');
|
||||
|
||||
module.exports = defineConfig({
|
||||
// Shared settings for all test types
|
||||
watchForFileChanges: false,
|
||||
screenshotOnRunFailure: false,
|
||||
video: false,
|
||||
defaultCommandTimeout: 10000,
|
||||
chromeWebSecurity: false,
|
||||
retries: {
|
||||
runMode: 2,
|
||||
openMode: 0,
|
||||
},
|
||||
|
||||
// E2E test configuration
|
||||
e2e: {
|
||||
specPattern: ['tests/e2e/*.spec.ts', 'tests/unit/*.spec.ts'],
|
||||
baseUrl: null, // No baseUrl to prevent server checks in headless mode
|
||||
supportFile: 'tests/support/e2e.ts',
|
||||
experimentalRunAllSpecs: true,
|
||||
testIsolation: false, // Allow shared context for unit tests
|
||||
setupNodeEvents(on, config) {
|
||||
// Disable baseUrl verification for headless testing
|
||||
on('before:browser:launch', (browser, launchOptions) => {
|
||||
return launchOptions;
|
||||
});
|
||||
return config;
|
||||
},
|
||||
},
|
||||
|
||||
// Component test configuration (for Vue components)
|
||||
component: {
|
||||
devServer: {
|
||||
framework: 'vue',
|
||||
bundler: 'webpack',
|
||||
},
|
||||
specPattern: 'tests/unit/*.spec.ts', // Component tests are in unit directory
|
||||
supportFile: 'tests/support/e2e.ts',
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user