Skip to content

Commit

Permalink
feat: update swagger-ui and swagger-client to latest versions (#4434)
Browse files Browse the repository at this point in the history
  • Loading branch information
char0n authored Sep 18, 2023
1 parent be36546 commit accb554
Show file tree
Hide file tree
Showing 11 changed files with 895 additions and 23,121 deletions.
1 change: 1 addition & 0 deletions config/jest/jest.artifact.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const path = require('path');
module.exports = {
rootDir: path.join(__dirname, '..', '..'),
testEnvironment: 'jsdom',
setupFiles: ['<rootDir>/test/unit/jest-shim.js'],
testMatch: ['**/test/build-artifacts/**/*.js'],
transformIgnorePatterns: ['/node_modules/(?!(swagger-client|react-syntax-highlighter)/)'],
};
2 changes: 2 additions & 0 deletions config/jest/jest.unit.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ module.exports = {
rootDir: path.join(__dirname, '..', '..'),
testEnvironment: 'jsdom',
testMatch: ['**/test/unit/*.js', '**/test/unit/**/*.js'],
setupFiles: ['<rootDir>/test/unit/jest-shim.js'],
setupFilesAfterEnv: ['<rootDir>/test/unit/setup.js'],
transformIgnorePatterns: ['/node_modules/(?!(swagger-client|react-syntax-highlighter)/)'],
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
'<rootDir>/test/build-artifacts/',
'<rootDir>/test/mocha/',
'<rootDir>/test/unit/jest-shim.js',
'<rootDir>/test/unit/setup.js',
'<rootDir>/test/unit/plugins/validate-semantic/validate-helper.js',
'<rootDir>/test/unit/mocks/ace.js'
Expand Down
23,938 changes: 844 additions & 23,094 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"deps-check:size": "webpack -p --config webpack/test_deps_size.babel.js --json | webpack-bundle-size-analyzer >| $npm_package_config_deps_check_dir/sizes.txt",
"dev": "webpack serve --config webpack/dev.babel.js",
"hot-server": "webpack serve --host 0.0.0.0 --config webpack/dev.babel.js",
"open-static": "node -e 'require(\"open\")(\"http://localhost:3001\")'",
"open-static": "open-cli 'http://localhost:3001'",
"lint": "eslint --cache --ext '.js,.jsx' src test",
"lint-errors": "eslint --cache --quiet --ext '.js,.jsx' src test",
"lint-fix": "eslint --cache --ext '.js,.jsx' src test --fix",
Expand All @@ -50,7 +50,6 @@
"test:unit-mocha": "cross-env BABEL_ENV=test mocha --require test/mocha/setup.js --recursive --require @babel/register test/mocha",
"test:unit-mocha-watch": "npm run test:unit-mocha -- -w",
"test:artifact": "jest --config ./config/jest/jest.artifact.config.js",
"prestart": "npm install",
"security-audit": "run-s -sc security-audit:all security-audit:prod",
"security-audit:prod": "npm-audit-ci-wrapper -p -t low",
"security-audit:all": "npm-audit-ci-wrapper -t moderate",
Expand Down Expand Up @@ -87,8 +86,8 @@
"react-transition-group": "^1.1.1",
"redux": "=4.2.1",
"reselect": "^4.0.0",
"swagger-client": "^3.20.0",
"swagger-ui": "^5.3.1",
"swagger-client": "^3.22.3",
"swagger-ui": "^5.7.2",
"traverse": "^0.6.6",
"validator": "=13.11.0",
"yaml-js": "^0.3.1"
Expand Down Expand Up @@ -134,8 +133,8 @@
"html-webpack-skip-assets-plugin": "^1.0.3",
"husky": "=8.0.3",
"inspectpack": "=4.7.1",
"jest": "^29.0.1",
"jest-environment-jsdom": "^29.0.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jsdom": "=22.1.0",
"jsdom-global": "3.0.2",
"json-loader": "0.5.7",
Expand All @@ -149,7 +148,7 @@
"npm-audit-ci-wrapper": "^3.0.1",
"npm-run-all": "^4.1.5",
"null-loader": "4.0.1",
"open": "^9.0.0",
"open-cli": "^7.2.0",
"path-browserify": "^1.0.1",
"postcss": "^8.4.5",
"postcss-loader": "^7.0.0",
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/definition-loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("Menu Definition Loading", () => {
cy.wait(50).contains("Load Petstore OAS 2.0").click()

cy.get(".info", { timeout: 10000 }).should("be.visible")
cy.get(".info .title").should("have.text", "Swagger Petstore 2.0 1.0.0 ")
cy.get(".info .title").should("have.text", "Swagger Petstore 2.0 1.0.0 OAS 2.0")
})
})

Expand Down
5 changes: 5 additions & 0 deletions test/unit/jest-shim.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { TextEncoder, TextDecoder } from 'node:util';

global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;
global.clearImmediate = clearImmediate;
8 changes: 4 additions & 4 deletions test/unit/plugins/editor-metadata/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ function getSystem(spec) {
spec,
domNode: null,
presets: [
SwaggerUI.plugins.SpecIndex,
SwaggerUI.plugins.ErrIndex,
SwaggerUI.plugins.Spec,
SwaggerUI.plugins.Err,
SwaggerUI.plugins.DownloadUrl,
SwaggerUI.plugins.SwaggerJsIndex,
SwaggerUI.plugins.RequestSnippetsIndex,
SwaggerUI.plugins.SwaggerClient,
SwaggerUI.plugins.RequestSnippets,
],
initialState: {
layout: undefined
Expand Down
8 changes: 4 additions & 4 deletions test/unit/plugins/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ function getSystem(spec) {
spec,
domNode: null,
presets: [
SwaggerUI.plugins.SpecIndex,
SwaggerUI.plugins.ErrIndex,
SwaggerUI.plugins.Spec,
SwaggerUI.plugins.Err,
SwaggerUI.plugins.DownloadUrl,
SwaggerUI.plugins.SwaggerJsIndex,
SwaggerUI.plugins.RequestSnippetsIndex,
SwaggerUI.plugins.SwaggerClient,
SwaggerUI.plugins.RequestSnippets,
],
initialState: {
layout: undefined
Expand Down
10 changes: 5 additions & 5 deletions test/unit/plugins/validate-semantic/validate-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export default function validateHelper(spec) {
spec,
domNode: null,
presets: [
SwaggerUI.plugins.SpecIndex,
SwaggerUI.plugins.ErrIndex,
SwaggerUI.plugins.Spec,
SwaggerUI.plugins.Err,
SwaggerUI.plugins.DownloadUrl,
SwaggerUI.plugins.SwaggerJsIndex,
SwaggerUI.plugins.Oas3Index,
SwaggerUI.plugins.RequestSnippetsIndex,
SwaggerUI.plugins.SwaggerClient,
SwaggerUI.plugins.OpenAPI30,
SwaggerUI.plugins.RequestSnippets,
],
initialState: {
layout: undefined
Expand Down
21 changes: 19 additions & 2 deletions test/unit/setup.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
// Jest config globals can go here
global.XMLHttpRequest = undefined;
import { JSDOM } from 'jsdom';

const jsdom = new JSDOM('<!doctype html><html><body></body></html>', {
url: 'http://localhost/',
});
const { window } = jsdom;

global.window = window;
global.document = window.document;
global.navigator = {
userAgent: 'node.js',
};
global.performance = window.performance;
global.performance.markResourceTiming = () => {};

window.clearImmediate = clearImmediate;
window.cancelAnimationFrame = window.clearTimeout;
window.requestAnimationFrame = (cb) => window.setTimeout(cb, 0);

8 changes: 4 additions & 4 deletions test/unit/standalone/topbar-insert/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ function getSystem(spec) {
spec,
domNode: null,
presets: [
SwaggerUI.plugins.SpecIndex,
SwaggerUI.plugins.ErrIndex,
SwaggerUI.plugins.Spec,
SwaggerUI.plugins.Err,
SwaggerUI.plugins.DownloadUrl,
SwaggerUI.plugins.SwaggerJsIndex,
SwaggerUI.plugins.RequestSnippetsIndex,
SwaggerUI.plugins.SwaggerClient,
SwaggerUI.plugins.RequestSnippets,
],
initialState: {
layout: undefined
Expand Down

0 comments on commit accb554

Please sign in to comment.