Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions dashboard/.babelrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"presets": [
["@babel/preset-env", { "targets": { "node": "12" } }],
["@babel/preset-react", { "runtime": "automatic" }],
["@babel/preset-typescript", { "allExtensions": true, "isTSX": true }]
]
}



23 changes: 22 additions & 1 deletion dashboard/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,26 @@ module.exports = {
"prefer-const": "off",
"no-var": "off",
"no-useless-catch": "warn"
}
},
overrides: [
{
files: [
"**/__tests__/**/*.{ts,tsx}",
"**/*.{test,spec}.{ts,tsx}",
"**/setupTests*.ts",
"src/**/__mocks__/**/*.{ts,tsx}",
],
env: { jest: true },
rules: {
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-loss-of-precision": "off",
"no-extra-semi": "off",
"no-mixed-spaces-and-tabs": "off",
"react-hooks/rules-of-hooks": "off",
"react-hooks/exhaustive-deps": "off",
},
},
],
};
3 changes: 3 additions & 0 deletions dashboard/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@ node_modules/
dist/
.vite/
.env

# Local Dependabot export for governance tests (optional)
config/dependabot-alerts.local.json
*.log
.vscode/
157 changes: 157 additions & 0 deletions dashboard/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Jest configuration for the Atlas React dashboard
*/

const runDependencyGovernance = process.env.RUN_DEPENDENCY_GOVERNANCE === '1'

const config = {
preset: 'ts-jest/presets/js-with-ts',
testEnvironment: 'jsdom',

// Test file patterns
testMatch: [
'<rootDir>/src/**/__tests__/**/*.{ts,tsx}',
'<rootDir>/src/**/*.{test,spec}.{ts,tsx}'
],

// Setup files
setupFilesAfterEnv: ['<rootDir>/src/setupTests.simple.ts'],

// Module name mapping for path aliases
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'^@components/(.*)$': '<rootDir>/src/components/$1',
'^@api/(.*)\.js$': '<rootDir>/src/api/$1.ts',
'^@api/(.*)$': '<rootDir>/src/api/$1',
'^@utils/(.*)\.js$': '<rootDir>/src/utils/$1.ts',
'^@utils/(.*)$': '<rootDir>/src/utils/$1',
'^@styles/(.*)$': '<rootDir>/src/styles/$1',
'^@services/(.*)$': '<rootDir>/src/services/$1',
'^@views/(.*)$': '<rootDir>/src/views/$1',
'^@hooks/(.*)$': '<rootDir>/src/hooks/$1',
'^@models/(.*)$': '<rootDir>/src/models/$1',
'^@contexts/(.*)$': '<rootDir>/src/contexts/$1',
'^@redux/(.*)$': '<rootDir>/src/redux/$1',
'\\.(css|less|scss|sass)$': '<rootDir>/src/__mocks__/styleMock.ts',
'\\.(jpg|jpeg|png|gif|svg|webp)$': '<rootDir>/src/__mocks__/fileMock.ts'
},

// File extensions to consider
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],

// Transform files (updated ts-jest config format)
transform: {
'^.+\\.(ts|tsx)$': ['ts-jest', {
tsconfig: 'tsconfig.test.json'
}],
'^.+\\.(js|jsx|mjs|cjs)$': 'babel-jest'
},

// Files to ignore during transformation
// Allow transpiling ESM-only d3 transitive deps for jest.requireActual('d3')
transformIgnorePatterns: [
'node_modules/(?!(@testing-library|@adobe/css-tools|react-quill-new|d3|d3-[-\\w]+|internmap|.*\\.mjs$))'
],

// Module paths to ignore (exclude bin/, dist/, build/, target/)
modulePathIgnorePatterns: [
'<rootDir>/bin/',
'<rootDir>/dist/',
'<rootDir>/build/',
'<rootDir>/target/'
],

testPathIgnorePatterns: [
'<rootDir>/bin/',
'<rootDir>/dist/',
'<rootDir>/build/',
'<rootDir>/target/',
...(runDependencyGovernance
? []
: ['<rootDir>/src/__tests__/governance/'])
],

// V8 avoids babel-plugin-istanbul + test-exclude, which breaks when npm
// overrides force minimatch@9 (minimatch is not a function in CJS).
coverageProvider: 'v8',

// Coverage configuration (only collect when --coverage flag is used)
collectCoverage: false,
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/**/__tests__/**',
'!src/**/*.test.{ts,tsx}',
'!src/**/*.spec.{ts,tsx}',
'!src/**/__mocks__/**',
'!src/**/setupTests*',
'!src/**/test-utils*'
],

coverageDirectory: 'coverage',

coverageReporters: [
'text',
'lcov',
'html',
'json-summary'
],

// Coverage thresholds
coverageThreshold: {
global: {
branches: 50,
functions: 50,
lines: 50,
statements: 50
}
},

// Verbose output
verbose: true,

// Clear mocks between tests
clearMocks: true,

// Reset modules between tests
resetMocks: false,

// Environment variables
testEnvironmentOptions: {
url: 'http://localhost:3000'
},

// Test timeout (prevent hanging tests)
testTimeout: 10000, // 10 seconds

// Maximum number of concurrent workers
maxWorkers: '50%',

// Bail on first failure (stop after first failing test suite)
bail: false,

// Force exit after tests complete (prevent hanging)
forceExit: true,

// Detect open handles that might prevent Jest from exiting
detectOpenHandles: false
};

export default config;
Loading
Loading