Skip to content

Commit

Permalink
EDSC-3937: Updates Vite configs
Browse files Browse the repository at this point in the history
  • Loading branch information
macrouch committed Jul 12, 2024
1 parent e9a7a94 commit 421fab8
Show file tree
Hide file tree
Showing 434 changed files with 316 additions and 6,209 deletions.
2 changes: 2 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
},
"sourceType": "unambiguous",
"plugins": [

"@babel/plugin-transform-object-rest-spread",
"@babel/plugin-transform-class-properties",
"@babel/plugin-transform-runtime",
"@babel/plugin-syntax-dynamic-import",
Expand Down
85 changes: 0 additions & 85 deletions cypress.config.js

This file was deleted.

22 changes: 22 additions & 0 deletions cypress.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { defineConfig } from 'cypress'
import vitePreprocessor from 'cypress-vite'

export default defineConfig({
viewportWidth: 1400,
viewportHeight: 900,
fixturesFolder: 'cypress/fixtures',
chromeWebSecurity: false,
retries: {
runMode: 2
},
env: {
test_cyress: true
},
e2e: {
setupNodeEvents(on) {
on('file:preprocessor', vitePreprocessor())
},
baseUrl: 'http://localhost:8080',
specPattern: 'cypress/e2e/**/*.cy.js'
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { graphQlGetSubscriptionsQuery } from '../../../../../support/graphQlGetS
import { commafy } from '../../../../../../static/src/js/util/commafy'
import { pluralize } from '../../../../../../static/src/js/util/pluralize'

import assocatedDoisGraphQlBody from './__mocks__/associated_dois/graphql.body.json' with { type: 'json' }
import collectionsBody from './__mocks__/common/collections.body.json' with { type: 'json' }
import commonHeaders from './__mocks__/common/common.headers.json' with { type: 'json' }
import associatedDoisGranulesBody from './__mocks__/associated_dois/granules.body.json' with { type: 'json' }
import graphQlHeaders from './__mocks__/common/graphql.headers.json' with { type: 'json' }
import reformattingGraphQlBody from './__mocks__/reformattings/graphql.body.json' with { type: 'json' }
import reformattingsGranulesBody from './__mocks__/reformattings/granules.body.json' with { type: 'json' }
import getSubscriptionsGraphQlBody from './__mocks__/common/getSubscriptions.graphql.body.json' with { type: 'json' }
import assocatedDoisGraphQlBody from './__mocks__/associated_dois/graphql.body.json'
import collectionsBody from './__mocks__/common/collections.body.json'
import commonHeaders from './__mocks__/common/common.headers.json'
import associatedDoisGranulesBody from './__mocks__/associated_dois/granules.body.json'
import graphQlHeaders from './__mocks__/common/graphql.headers.json'
import reformattingGraphQlBody from './__mocks__/reformattings/graphql.body.json'
import reformattingsGranulesBody from './__mocks__/reformattings/granules.body.json'
import getSubscriptionsGraphQlBody from './__mocks__/common/getSubscriptions.graphql.body.json'

/**
* Tests the search panel header and meta text for results size
Expand Down
15 changes: 6 additions & 9 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

// const vitePreprocessor = require('cypress-vite')
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config

// module.exports = (on, config) => {
// // `on` is used to hook into various events Cypress emits
// // `config` is the resolved Cypress config
require('@cypress/code-coverage/task')(on, config)

// // require('@cypress/code-coverage/task')(on, config)
// // on('file:preprocessor', vitePreprocessor())

// // return config
// }
return config
}
12 changes: 6 additions & 6 deletions jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ const esModulesToIgnore = ['nanoid', 'lodash-es', 'sinon'].join('|')
module.exports = {
collectCoverage: false,
collectCoverageFrom: [
'serverless/src/**/*.jsx',
'static/src/**/*.jsx',
'sharedUtils/**/*.jsx'
'serverless/src/**/*.js',
'static/src/**/*.js',
'sharedUtils/**/*.js'
],
moduleNameMapper: {
// Use the moduleNameMapper for all images except the logo.png that exist in the portals directory
'(?<!/portals)(?<!/logo).(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/static/src/js/util/mocks/fileMock.jsx',
'(?<!/portals)(?<!/logo).(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/static/src/js/util/mocks/fileMock.js',
'^.+\\.(css|less|scss)$': 'babel-jest',
// Force module uuid to resolve with the CJS entry point, because Jest does not support package.json.exports. See https://github.com/uuidjs/uuid/issues/451
uuid: require.resolve('uuid'),
'^nanoid(/(.*)|$)': 'nanoid$1',
'react-leaflet': '<rootDir>/static/src/js/util/mocks/reactLeafletMock.jsx',
'react-leaflet': '<rootDir>/static/src/js/util/mocks/reactLeafletMock.js',
// After the update to 1.x the CJS changed import method. Adding a module mapper to resolve issues. See https://stackoverflow.com/a/74079349
'^axios$': require.resolve('axios')
},
Expand All @@ -34,7 +34,7 @@ module.exports = {
transform: {
// Use the fileTransformer for all the logo.pngs that exist in the portals directory
'(?<=/portals)(?<=/logo).png':
'<rootDir>/static/src/js/util/jest/fileTransformer.jsx',
'<rootDir>/static/src/js/util/jest/fileTransformer.cjs',
'^.+\\.(js|jsx)$': 'babel-jest'
},
testEnvironment: 'jsdom',
Expand Down
26 changes: 26 additions & 0 deletions oldbabel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
presets: [
[
'@babel/preset-env', {
targets: {
node: '18',
esmodules: true,
ie: '11'
}
}
],
'@babel/preset-react'
],
sourceType: 'unambiguous',
plugins: [
'@babel/plugin-transform-object-rest-spread',
'@babel/plugin-transform-class-properties',
'@babel/plugin-transform-runtime',
'@babel/plugin-syntax-dynamic-import'
],
env: {
playwright: {
plugins: ['istanbul']
}
}
}
Loading

0 comments on commit 421fab8

Please sign in to comment.