Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
[OKD-core] Make @novnc working in jest
Browse files Browse the repository at this point in the history
  • Loading branch information
mareklibra committed Nov 27, 2018
1 parent f5345cd commit c42fb16
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
5 changes: 3 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@
".(ts|tsx|js|jsx)": "./node_modules/ts-jest/preprocessor.js"
},
"transformIgnorePatterns": [
"<rootDir>/node_modules/(?!lodash-es/.*)"
"<rootDir>/node_modules/(?!(lodash-es|@novnc)/.*)"
],
"testRegex": "/__tests__/.*\\.(ts|tsx|js|jsx)$",
"setupFiles": [
"./__mocks__/requestAnimationFrame.js",
"./__mocks__/localStorage.ts",
"./__mocks__/matchMedia.js",
"./before-tests.js"
"./before-tests.js",
"./polyfills-kubevirt.js"
],
"coverageDirectory": "__coverage__",
"coverageReporters": [
Expand Down
8 changes: 8 additions & 0 deletions frontend/polyfills-kubevirt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* eslint-disable */

global.MutationObserver = global.MutationObserver || class {
constructor(callback) {}
disconnect() {}
observe(element, initObject) {}
};

2 changes: 1 addition & 1 deletion frontend/public/kubevirt/components/utils/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const getVncConnectionDetails = vmi => {
const encrypt = window.location.protocol === 'https:';
// the novnc library requires protocol to be specified so the URL must be absolute - including host:port
return {
encrypt, // whether ws or wss to be used
encrypt: isEncrypted(), // whether ws or wss to be used
host: window.location.hostname,
port: window.location.port || (encrypt ? '443' : '80'),
path: `${context}/${apiPath}/vnc${query}`,
Expand Down
2 changes: 1 addition & 1 deletion frontend/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let config: webpack.Configuration = {
{ test: /\.glsl$/, loader: 'raw!glslify' },
{
test: /(\.jsx?)|(\.tsx?)$/,
exclude: /node_modules/,
exclude: /node_modules\/(?!(@novnc)\/).*/,
use: [
{ loader: 'cache-loader' },
{
Expand Down

0 comments on commit c42fb16

Please sign in to comment.