Skip to content

Commit

Permalink
chore(ui): Change testEnvironment from node to jsdom (argoproj#16287)
Browse files Browse the repository at this point in the history
Signed-off-by: Rafal Pelczar <rafal@akuity.io>
  • Loading branch information
rpelczar authored Nov 9, 2023
1 parent 72245e8 commit b33b7fa
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions ui/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testEnvironment: 'jsdom',
reporters: ['default', 'jest-junit'],
collectCoverage: true,
transformIgnorePatterns: ['node_modules/(?!(argo-ui)/)'],
globals: {
'self': {},
'window': {localStorage: { getItem: () => '{}', setItem: () => null }},
'ts-jest': {
isolatedModules: true,
},
Expand All @@ -17,20 +16,3 @@ module.exports = {
'.+\\.(css|styl|less|sass|scss)$': 'jest-transform-css',
},
};

const localStorageMock = (() => {
let store = {};
return {
getItem: (key) => store[key],
setItem: (key, value) => {
store[key] = value.toString();
},
clear: () => {
store = {};
},
removeItem: (key) => {
delete store[key];
}
};
})();
global.localStorage = localStorageMock;

0 comments on commit b33b7fa

Please sign in to comment.