Skip to content
Draft
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
build
coverage
cypress/videos/
cypress/screenshots/
cypress/downloads/
Expand Down
32 changes: 32 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = function (api) {
api.cache.forever()

let presets

if (process.env.BABEL_ENV === 'modules') {
presets = []
} else {
presets = [
[
'@babel/preset-env',
{
modules: 'commonjs',
},
],
'@babel/preset-react',
]
}

return {
presets,
plugins: [
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-class-properties',
],
env: {
test: {
plugins: ['@babel/plugin-transform-runtime', 'babel-plugin-transform-import-meta'],
},
},
}
}
8 changes: 7 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ module.exports = {
collectCoverageFrom: ['src/**/*.js'],
testPathIgnorePatterns: ['/node_modules/', '/cypress/'],
transformIgnorePatterns: [
'/node_modules/(?!d3-(array|axis|color|format|interpolate|scale|selection|time)|internmap)',
// allow transforming some ESM modules that ship modern syntax
'/node_modules/(?!(d3-(array|axis|color|format|interpolate|scale|selection|time|time-format|scale)|d3-scale|d3-time-format|internmap|workbox-precaching|workbox-core|workbox-strategies|workbox-routing|@dhis2/pwa|@dhis2/app-adapter)/)'
],
moduleNameMapper: {
'\\.(css)$': 'identity-obj-proxy',
// Map relative .d2/shell imports for cypress plugins back to repo cypress folder
'^\\.\\./\\.\\./cypress/plugins/(.*)$': '<rootDir>/cypress/plugins/$1',
// Map relative .d2/shell import for d2.config back to repo root d2.config
'^\\.\\.\\/\\.\\.\\/d2.config.js$': '<rootDir>/d2.config.js',
},
testURL: 'http://localhost/',
testEnvironment: 'jsdom',

testRunner: 'jest-circus/runner',
reporters: ['default'],
Expand Down
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"build": "d2-app-scripts build",
"start": "node scripts/copy-ee-worker-files.js && d2-app-scripts start",
"test": "d2-app-scripts test",
"jest:direct": "npx jest",
"deploy": "d2-app-scripts deploy",
"lint": "d2-style check",
"format": "d2-style apply",
Expand All @@ -18,6 +19,12 @@
"cy:run": "start-server-and-test 'yarn start' http://localhost:3000 'yarn cypress run'"
},
"devDependencies": {
"@babel/core": "7.24.7",
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
"@babel/plugin-transform-runtime": "7.24.7",
"@babel/preset-env": "7.24.7",
"@babel/preset-react": "7.24.7",
"@dhis2/cli-app-scripts": "^12.7.2",
"@dhis2/cli-style": "^10.7.9",
"@dhis2/cypress-commands": "^10.1.0",
Expand All @@ -28,12 +35,15 @@
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0",
"babel-jest": "27.5.1",
"babel-plugin-transform-import-meta": "2.2.1",
"cypress": "^14",
"cypress-real-events": "^1.14.0",
"cypress-tags": "^1.2.2",
"cypress-wait-until": "^3",
"eslint-plugin-cypress": "^2.15.1",
"identity-obj-proxy": "^3.0.0",
"jest": "27.5.1",
"jest-webgl-canvas-mock": "^2.5.3",
"patch-package": "^6.5.1",
"redux-devtools": "^3.7.0",
Expand All @@ -42,6 +52,7 @@
"start-server-and-test": "^2.0.11"
},
"dependencies": {
"@babel/runtime": "7.24.7",
"@dhis2/analytics": "^29.0.2",
"@dhis2/app-runtime": "^3.14.4",
"@dhis2/app-service-datastore": "^1.0.0-beta.3",
Expand Down
Loading
Loading