Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
Fix/webpack dependency warnings (#330)
Browse files Browse the repository at this point in the history
* Increase 'uuid' 'eslint' 'strip-ansi' 'coveralls' version & use 'ModuleUtils.tryRequire' for fix bundling issues & fix vulnerability errors

* Set 'strip-ansi' version to '^6.0.0'
  • Loading branch information
bcaglayan authored Feb 24, 2022
1 parent 2d9a17a commit b07dc64
Show file tree
Hide file tree
Showing 7 changed files with 20,214 additions and 823 deletions.
20,985 changes: 20,186 additions & 799 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,18 @@
"@types/aws-lambda": "^8.10.85",
"@types/minimatch": "^3.0.3",
"@types/node": "^10.5.0",
"@types/strip-ansi": "^5.0.0",
"@types/uuid": "^3.4.3",
"@types/strip-ansi": "^5.2.1",
"@types/uuid": "^8.3.4",
"amqplib": "^0.8.0",
"aws-sdk": "^2.610.0",
"aws-xray-sdk-core": "^2.0.1",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^9.0.0",
"babel-jest": "^27.0.0",
"copyfiles": "^2.4.1",
"coveralls": "^3.0.1",
"coveralls": "^3.1.1",
"elasticsearch": "^15.4.1",
"eslint": "^4.19.1",
"eslint": "^8.9.0",
"eslint-plugin-babel": "^5.1.0",
"express": "^4.17.1",
"gaze-run-interrupt": "^1.0.1",
Expand Down Expand Up @@ -142,9 +142,9 @@
"require-in-the-middle": "^3.1.0",
"semver": "^5.5.0",
"shimmer": "^1.2.0",
"strip-ansi": "^5.0.0",
"strip-ansi": "^6.0.0",
"url-parse": "^1.5.3",
"uuid": "^3.2.1",
"uuid": "^8.3.2",
"ws": "^7.2.1"
}
}
4 changes: 3 additions & 1 deletion src/bootstrap/foresight/jest/JestEnvironmentJsdom.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require('../index');

module.exports = require('jest-environment-jsdom');
const { ModuleUtils } = require('../../../thundraInternalApi');

module.exports = ModuleUtils.tryRequire('jest-environment-jsdom');
4 changes: 3 additions & 1 deletion src/bootstrap/foresight/jest/JestEnvironmentNode.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require('../index');

module.exports = require('jest-environment-node');
const { ModuleUtils } = require('../../../thundraInternalApi');

module.exports = ModuleUtils.tryRequire('jest-environment-node');
4 changes: 2 additions & 2 deletions src/utils/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import { ApplicationInfo } from '../application/ApplicationInfo';
import ThundraSpanListener from '../listeners/ThundraSpanListener';
import PluginContext from '../plugins/PluginContext';

const uuidv4 = require('uuid/v4');
const uuidv5 = require('uuid/v5');
import { v4 as uuidv4 } from 'uuid';
import { v5 as uuidv5 } from 'uuid';
const zlib = require('zlib');

const globalAppID = uuidv4();
Expand Down
12 changes: 6 additions & 6 deletions src/wrappers/foresight/lib/jest/ModuleLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const wrapTestRequireModule = () => {
};
}

const jestRuntime = require('jest-runtime');
const jestRuntime = ModuleUtils.tryRequire('jest-runtime');
if (jestRuntime) {
if (has(jestRuntime, 'prototype.requireModule')) {
ThundraLogger.debug('<ModuleLoader> Wrapping "jest-runtime.requireModule"');
Expand All @@ -54,7 +54,7 @@ export const wrapTestRequireModule = () => {
};

export const unwrapTestRequireModule = () => {
const jestRuntime = require('jest-runtime');
const jestRuntime = ModuleUtils.tryRequire('jest-runtime');
if (jestRuntime) {
if (has(jestRuntime, 'prototype.requireModule')) {
ThundraLogger.debug('<ModuleLoader> Unwrapping "jest-runtime.requireModule"');
Expand All @@ -78,7 +78,7 @@ export const wrapTestTransformFile = (tracePlugin: Trace) => {
};
}

const jestRuntime = require('jest-runtime');
const jestRuntime = ModuleUtils.tryRequire('jest-runtime');
if (jestRuntime) {
if (has(jestRuntime, 'prototype.transformFile')) {
ThundraLogger.debug('<ModuleLoader> Wrapping "jest-runtime.transformFile"');
Expand All @@ -91,7 +91,7 @@ export const wrapTestTransformFile = (tracePlugin: Trace) => {
};

export const unwrapTestTransformFile = () => {
const jestRuntime = require('jest-runtime');
const jestRuntime = ModuleUtils.tryRequire('jest-runtime');
if (jestRuntime) {
if (has(jestRuntime, 'prototype.transformFile')) {
ThundraLogger.debug('<ModuleLoader> Unwrapping "jest-runtime.transformFile"');
Expand Down Expand Up @@ -126,7 +126,7 @@ export const wrapTestTransformFileAsync = (tracePlugin: Trace) => {
};
}

const jestRuntime = require('jest-runtime');
const jestRuntime = ModuleUtils.tryRequire('jest-runtime');
if (jestRuntime) {
if (has(jestRuntime, 'prototype.transformFileAsync')) {
ThundraLogger.debug('<ModuleLoader> Wrapping "jest-runtime.transformFileAsync"');
Expand All @@ -139,7 +139,7 @@ export const wrapTestTransformFileAsync = (tracePlugin: Trace) => {
};

export const unwrapTestTransformFileAsync = () => {
const jestRuntime = require('jest-runtime');
const jestRuntime = ModuleUtils.tryRequire('jest-runtime');
if (jestRuntime) {
if (has(jestRuntime, 'prototype.transformFileAsync')) {
ThundraLogger.debug('<ModuleLoader> Unwrapping "jest-runtime.transformFileAsync"');
Expand Down
16 changes: 8 additions & 8 deletions src/wrappers/foresight/lib/jest/ThundraJestEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,16 @@ function wrapEnvironment(BaseEnvironment: any) {
let error: TestRunError;

if (event.test && event.test.parent) {
const test = event.test;
const test = event.test;

id = testSuite + '-' + test.parent.name;
testName = test.name;
testDuration = test.duration;
id = testSuite + '-' + test.parent.name;
testName = test.name;
testDuration = test.duration;

const errorArr = test.errors;
if (errorArr && errorArr.length) {
error = ErrorParser.buildError(test.errors, test.asyncError);
}
const errorArr = test.errors;
if (errorArr && errorArr.length) {
error = ErrorParser.buildError(test.errors, test.asyncError);
}
}

return TestSuiteEvent
Expand Down

0 comments on commit b07dc64

Please sign in to comment.