Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes to issue #1558 regarding failed Jest test cases #1577

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 21 additions & 10 deletions assets/config/jest/cssTransform.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
'use strict'
// // This is a custom Jest transformer turning style imports into empty objects.
// // http://facebook.github.io/jest/docs/en/webpack.html

// This is a custom Jest transformer turning style imports into empty objects.
// http://facebook.github.io/jest/docs/en/webpack.html
// const cssTransform = {
// process() {
// return 'module.exports = {};';
// },
// getCacheKey() {
// // The output is always the same.
// return 'cssTransform';
// }
// };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should always remove commented code , if not used


const babelJest = require('babel-jest');

// Export the transformer function
module.exports = {
process () {
return 'module.exports = {};'
process(src, filename, config, options) {
return babelJest.process(src, filename, config, options);
},
getCacheKey () {
// The output is always the same.
return 'cssTransform'
}
}
'type': 'module',
extensionsToTreatAsEsm: ['.js', '.jsx']
};


2 changes: 1 addition & 1 deletion assets/src/components/d3/createHistogram.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as d3 from 'd3'
import * as d3 from 'd3/dist/d3.min'
Copy link
Contributor

@pushyamig pushyamig Apr 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel we import things from dist folder. This change effects the View. why are you doing this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of the imports in the project we use dist in path while importing. This needs to be changed.

import { adjustViewport } from '../../util/chart'
import { roundToXDecimals } from '../../util/math'
import { siteTheme } from '../../globals'
Expand Down
2 changes: 1 addition & 1 deletion assets/src/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const mylaGlobals = mylaGlobalsEl ? JSON.parse(mylaGlobalsEl.textContent) : {}

let cspNonce
const cspMetaEl = document.querySelector('meta[name="csp-nonce"]')
if (cspMetaEl !== null & cspMetaEl.hasAttribute('content')) {
if (cspMetaEl !== null && cspMetaEl.hasAttribute('content')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undo the change here as I don't feel this needed any change

cspNonce = cspMetaEl.getAttribute('content')
}

Expand Down