Skip to content
Merged
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
3 changes: 3 additions & 0 deletions frontend/__mocks__/serverFlags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
window.SERVER_FLAGS = {
basePath: '/',
};
5 changes: 0 additions & 5 deletions frontend/before-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
import { configure } from 'enzyme';
import * as Adapter from 'enzyme-adapter-react-16';

import './setup-jsdom';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've realized that Jest takes care of this already via testEnvironment option which defaults to jsdom, i.e. using jest-environment-jsdom implementation.

Jest TestEnvironment is sandboxed, with each test suite having its own env. instance prepared upon setup and destroyed upon teardown.

Since plugin-stats now uses browser-env to setup jsdom, I'm removing this import.

import 'url-search-params-polyfill';

// http://airbnb.io/enzyme/docs/installation/index.html#working-with-react-16
configure({ adapter: new Adapter() });

window.SERVER_FLAGS = {
basePath: '/',
};
4 changes: 3 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"test-suite": "ts-node -O '{\"module\":\"commonjs\"}' ./node_modules/.bin/protractor integration-tests/protractor.conf.ts",
"debug-test-suite": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' node -r ts-node/register --inspect-brk ./node_modules/.bin/protractor integration-tests/protractor.conf.ts",
"analyze": "NODE_ENV=production ts-node -O '{\"module\":\"commonjs\"}' ./node_modules/.bin/webpack --mode=production --profile --json | awk '{if(NR>2)print}' > public/dist/stats.json && ts-node -O '{\"module\":\"commonjs\"}' ./node_modules/.bin/webpack-bundle-analyzer --mode static -r public/dist/report.html public/dist/stats.json",
"plugin-stats": "ts-node -O '{\"module\":\"commonjs\"}' ./plugin-stats.ts"
"plugin-stats": "node ./plugin-stats.js"
},
"jest": {
"moduleFileExtensions": [
Expand All @@ -47,6 +47,7 @@
"setupFiles": [
"./__mocks__/localStorage.ts",
"./__mocks__/matchMedia.js",
"./__mocks__/serverFlags.js",
"./before-tests.js"
],
"coverageDirectory": "__coverage__",
Expand Down Expand Up @@ -143,6 +144,7 @@
"@types/react-virtualized": "9.x",
"@types/webpack": "4.x",
"bootstrap-sass": "^3.3.7",
"browser-env": "3.x",
"cache-loader": "1.x",
"chalk": "2.3.x",
"chromedriver": "^2.43.3",
Expand Down
33 changes: 33 additions & 0 deletions frontend/plugin-stats.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-env node */

require('ts-node').register({
typeCheck: false,
compilerOptions: {
...require('./tsconfig.json').compilerOptions,
module: 'commonjs',
},
ignore: [
/node_modules\/(?!lodash-es|@console|@spice-project)/,
],
});

// When an extension is unknown to Node.js, ts-node handles the file as ".js".
// https://github.com/TypeStrong/ts-node/issues/175#issuecomment-455429261
['.css', '.scss'].forEach(ext => {
require.extensions[ext] = () => undefined;
});

// Assume test environment for the purpose of Console plugin stat reporting.
process.env.NODE_ENV = 'test';

require('browser-env')({ url: 'http://localhost' });
require('./__mocks__/matchMedia');
require('./__mocks__/serverFlags');

const {
resolvePluginPackages,
loadActivePlugins,
printPluginStats,
} = require('@console/plugin-sdk/src/codegen');

printPluginStats(loadActivePlugins(resolvePluginPackages()));
18 changes: 0 additions & 18 deletions frontend/plugin-stats.ts

This file was deleted.

27 changes: 0 additions & 27 deletions frontend/setup-jsdom.js

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"exclude": [
".yarn",
"**/node_modules",
"public/dist",
"public/dist"
],
"include": [
"**/*.js",
Expand Down
94 changes: 88 additions & 6 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ acorn-globals@^3.1.0:
dependencies:
acorn "^4.0.4"

acorn-globals@^4.3.2:
acorn-globals@^4.3.0, acorn-globals@^4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.2.tgz#4e2c2313a597fd589720395f6354b41cd5ec8006"
integrity sha512-BbzvZhVtZP+Bs1J1HcwrQe8ycfO0wStkSGxuul3He3GkHOIZ6eTqOkPuw9IP1X3+IkOo4wiJmwkobzXYz4wewQ==
Expand Down Expand Up @@ -1016,6 +1016,11 @@ acorn@^6.0.1, acorn@^6.0.5, acorn@^6.0.7, acorn@^6.1.1:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.1.1.tgz#7d25ae05bb8ad1f9b699108e1094ecd7884adc1f"
integrity sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==

acorn@^6.0.4:
version "6.2.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.2.0.tgz#67f0da2fc339d6cfb5d6fb244fd449f33cd8bbe3"
integrity sha512-8oe72N3WPMjA+2zVG71Ia0nXZ8DpQH+QyyHO+p06jT8eg8FGG3FbcUIi8KziHlAfheJQZeoqbvq1mQSQHXKYLw==

add-line-numbers@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/add-line-numbers/-/add-line-numbers-1.0.1.tgz#48dbbdea47dbd234deafeac6c93cea6f70b4b7e3"
Expand Down Expand Up @@ -2585,6 +2590,13 @@ brorand@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"

browser-env@3.x:
version "3.2.6"
resolved "https://registry.yarnpkg.com/browser-env/-/browser-env-3.2.6.tgz#a10872b92a25b02ddd17de76ca479744de82d8e7"
integrity sha512-FJ1dwr5gWEP2Igv1/acvLaMPUTwIqdBJsAL3prDfcjRG9G5/y70WN6M8uCNIyITHC+mMj0W9RkkCz9DFE5s4MQ==
dependencies:
window "4.2.6"

browser-process-hrtime@^0.1.2:
version "0.1.3"
resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz#616f00faef1df7ec1b5bf9cfe2bdc3170f26c7b4"
Expand Down Expand Up @@ -3835,6 +3847,11 @@ cssom@^0.3.4, cssom@^0.3.6:
resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.6.tgz#f85206cee04efa841f3c5982a74ba96ab20d65ad"
integrity sha512-DtUeseGk9/GBW0hl0vVPpU22iHL6YB5BUX7ml1hB+GMpo0NX5G4voX3kdWiMSEguFtcW3Vh3djqNF4aIe6ne0A==

cssom@~0.3.6:
version "0.3.8"
resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a"
integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==

"cssstyle@>= 0.2.37 < 0.3.0":
version "0.2.37"
resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-0.2.37.tgz#541097234cb2513c83ceed3acddc27ff27987d54"
Expand All @@ -3848,6 +3865,13 @@ cssstyle@^0.3.1:
dependencies:
cssom "0.3.x"

cssstyle@^1.1.1:
version "1.3.0"
resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-1.3.0.tgz#c36c466f7037fd30f03baa271b65f0f17b50585c"
integrity sha512-wXsoRfsRfsLVNaVzoKdqvEmK/5PFaEXNspVT22Ots6K/cnJdpoDKuQFw+qlMiXnmaif1OgeC466X1zISgAOcGg==
dependencies:
cssom "~0.3.6"

cssstyle@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-1.2.2.tgz#427ea4d585b18624f6fdbf9de7a2a1a3ba713077"
Expand Down Expand Up @@ -4954,7 +4978,7 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"

escodegen@^1.11.1:
escodegen@^1.11.0, escodegen@^1.11.1:
version "1.11.1"
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.11.1.tgz#c485ff8d6b4cdb89e27f4a856e91f118401ca510"
integrity sha512-JwiqFD9KdGVVpeuRa68yU3zZnBEOcPs0nKW7wZzXky8Z7tffdYUHbe11bPCV5jYlK6DVdKLWLm0f5I/QlL0Kmw==
Expand Down Expand Up @@ -8300,6 +8324,38 @@ jscodeshift@^0.5.0:
temp "^0.8.1"
write-file-atomic "^1.2.0"

jsdom@13.2.0:
version "13.2.0"
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-13.2.0.tgz#b1a0dbdadc255435262be8ea3723d2dba0d7eb3a"
integrity sha512-cG1NtMWO9hWpqRNRR3dSvEQa8bFI6iLlqU2x4kwX51FQjp0qus8T9aBaAO6iGp3DeBrhdwuKxckknohkmfvsFw==
dependencies:
abab "^2.0.0"
acorn "^6.0.4"
acorn-globals "^4.3.0"
array-equal "^1.0.0"
cssom "^0.3.4"
cssstyle "^1.1.1"
data-urls "^1.1.0"
domexception "^1.0.1"
escodegen "^1.11.0"
html-encoding-sniffer "^1.0.2"
nwsapi "^2.0.9"
parse5 "5.1.0"
pn "^1.1.0"
request "^2.88.0"
request-promise-native "^1.0.5"
saxes "^3.1.5"
symbol-tree "^3.2.2"
tough-cookie "^2.5.0"
w3c-hr-time "^1.0.1"
w3c-xmlserializer "^1.0.1"
webidl-conversions "^4.0.2"
whatwg-encoding "^1.0.5"
whatwg-mimetype "^2.3.0"
whatwg-url "^7.0.0"
ws "^6.1.2"
xml-name-validator "^3.0.0"

jsdom@^15.1.0:
version "15.1.1"
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-15.1.1.tgz#21ed01f81d95ef4327f3e564662aef5e65881252"
Expand Down Expand Up @@ -9861,7 +9917,7 @@ numeric@^1.2.6:
version "1.4.4"
resolved "https://registry.yarnpkg.com/nwmatcher/-/nwmatcher-1.4.4.tgz#2285631f34a95f0d0395cd900c96ed39b58f346e"

nwsapi@^2.1.4:
nwsapi@^2.0.9, nwsapi@^2.1.4:
version "2.1.4"
resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.1.4.tgz#e006a878db23636f8e8a67d33ca0e4edf61a842f"
integrity sha512-iGfd9Y6SFdTNldEy2L0GUhcarIutFmk+MPWIn9dmj8NMIup03G08uUF2KGbbmv/Ux4RT0VZJoP/sVbWA6d/VIw==
Expand Down Expand Up @@ -12233,7 +12289,7 @@ request-promise-core@1.1.2:
dependencies:
lodash "^4.17.11"

request-promise-native@^1.0.7:
request-promise-native@^1.0.5, request-promise-native@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.7.tgz#a49868a624bdea5069f1251d0a836e0d89aa2c59"
integrity sha512-rIMnbBdgNViL37nZ1b3L/VfPOpSi0TqVDQPAvO6U14lMzOLrt5nilxCQqtDKhZeDiW0/hkCXGoQjhgJd/tCh6w==
Expand Down Expand Up @@ -12712,6 +12768,13 @@ sax@>=0.6.0, sax@^1.2.1, sax@^1.2.4, sax@~1.2.1:
version "1.2.4"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"

saxes@^3.1.5:
version "3.1.11"
resolved "https://registry.yarnpkg.com/saxes/-/saxes-3.1.11.tgz#d59d1fd332ec92ad98a2e0b2ee644702384b1c5b"
integrity sha512-Ydydq3zC+WYDJK1+gRxRapLIED9PWeSuuS41wqyoRmzvhhh9nc+QQrVMKJYzJFULazeGhzSV0QleN2wD3boh2g==
dependencies:
xmlchars "^2.1.1"

saxes@^3.1.9:
version "3.1.9"
resolved "https://registry.yarnpkg.com/saxes/-/saxes-3.1.9.tgz#c1c197cd54956d88c09f960254b999e192d7058b"
Expand Down Expand Up @@ -13980,7 +14043,7 @@ tough-cookie@^2.3.2, tough-cookie@~2.3.0, tough-cookie@~2.3.3:
dependencies:
punycode "^1.4.1"

tough-cookie@^2.3.3:
tough-cookie@^2.3.3, tough-cookie@^2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2"
integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==
Expand Down Expand Up @@ -14950,7 +15013,7 @@ w3c-hr-time@^1.0.1:
dependencies:
browser-process-hrtime "^0.1.2"

w3c-xmlserializer@^1.1.2:
w3c-xmlserializer@^1.0.1, w3c-xmlserializer@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-1.1.2.tgz#30485ca7d70a6fd052420a3d12fd90e6339ce794"
integrity sha512-p10l/ayESzrBMYWRID6xbuCKh2Fp77+sA0doRuGn4tTIMrrZVeqfpKjXHY+oDh3K4nLdPgNwMTVP6Vp4pvqbNg==
Expand Down Expand Up @@ -15217,6 +15280,13 @@ window-size@0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"

window@4.2.6:
version "4.2.6"
resolved "https://registry.yarnpkg.com/window/-/window-4.2.6.tgz#27e44d6688bbd23634be24d4007061ce071c70f3"
integrity sha512-vk5Uv4hlPkZjUTAUVJUyvJQrbA05T99Qm3CTk0krXHKdoghxV70uPbHK3uGmrI1SfyJpdYncvZ7CbewJ30e9MQ==
dependencies:
jsdom "13.2.0"

wordwrap@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"
Expand Down Expand Up @@ -15282,6 +15352,13 @@ ws@^4.0.0:
async-limiter "~1.0.0"
safe-buffer "~5.1.0"

ws@^6.1.2:
version "6.2.1"
resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb"
integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==
dependencies:
async-limiter "~1.0.0"

ws@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/ws/-/ws-7.0.0.tgz#79351cbc3f784b3c20d0821baf4b4ff809ffbf51"
Expand Down Expand Up @@ -15318,6 +15395,11 @@ xmlchars@^1.3.1:
resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-1.3.1.tgz#1dda035f833dbb4f86a0c28eaa6ca769214793cf"
integrity sha512-tGkGJkN8XqCod7OT+EvGYK5Z4SfDQGD30zAa58OcnAa0RRWgzUEK72tkXhsX1FZd+rgnhRxFtmO+ihkp8LHSkw==

xmlchars@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.1.1.tgz#ef1a81c05bff629c2280007f12daca21bd6f6c93"
integrity sha512-7hew1RPJ1iIuje/Y01bGD/mXokXxegAgVS+e+E0wSi2ILHQkYAH1+JXARwTjZSM4Z4Z+c73aKspEcqj+zPPL/w==

xmldom@^0.1.22:
version "0.1.27"
resolved "https://registry.yarnpkg.com/xmldom/-/xmldom-0.1.27.tgz#d501f97b3bdb403af8ef9ecc20573187aadac0e9"
Expand Down