From d2c15d69874cc041c750222b51095d0552e145d9 Mon Sep 17 00:00:00 2001 From: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:13:02 +0300 Subject: [PATCH] Remove spec-(j|x)unit-reporter packages (#89732) --- .eslintrc.js | 2 -- .gitignore | 1 - packages/spec-junit-reporter/index.js | 1 - .../lib/spec-junit-reporter.js | 36 ------------------- packages/spec-junit-reporter/package.json | 23 ------------ packages/spec-junit-reporter/tsconfig.json | 3 -- packages/spec-xunit-reporter/index.js | 1 - .../lib/spec-xunit-reporter.js | 35 ------------------ packages/spec-xunit-reporter/package.json | 22 ------------ packages/spec-xunit-reporter/tsconfig.json | 3 -- yarn.lock | 21 ----------- 11 files changed, 148 deletions(-) delete mode 100755 packages/spec-junit-reporter/index.js delete mode 100644 packages/spec-junit-reporter/lib/spec-junit-reporter.js delete mode 100644 packages/spec-junit-reporter/package.json delete mode 100644 packages/spec-junit-reporter/tsconfig.json delete mode 100755 packages/spec-xunit-reporter/index.js delete mode 100644 packages/spec-xunit-reporter/lib/spec-xunit-reporter.js delete mode 100644 packages/spec-xunit-reporter/package.json delete mode 100644 packages/spec-xunit-reporter/tsconfig.json diff --git a/.eslintrc.js b/.eslintrc.js index 3c1e589a15557..1e7e5b20cb2a6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -242,8 +242,6 @@ module.exports = { './packages/i18n-calypso/package.json', './packages/i18n-utils/package.json', './packages/photon/package.json', - './packages/spec-junit-reporter/package.json', - './packages/spec-xunit-reporter/package.json', ], rules: { '@automattic/json/valid-values-name-scope': 'off', diff --git a/.gitignore b/.gitignore index 452a8c596c557..11d46e8a9b8a8 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,6 @@ test-results*.xml /client/stats-server.json /client/chart.json /client/style.json -spec-xunit-reporter-0.0.1.tgz *xunit_*.xml /vendor checkstyle.xml diff --git a/packages/spec-junit-reporter/index.js b/packages/spec-junit-reporter/index.js deleted file mode 100755 index 86a936f785820..0000000000000 --- a/packages/spec-junit-reporter/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require( './lib/spec-junit-reporter.js' ); diff --git a/packages/spec-junit-reporter/lib/spec-junit-reporter.js b/packages/spec-junit-reporter/lib/spec-junit-reporter.js deleted file mode 100644 index ac85939ac9a97..0000000000000 --- a/packages/spec-junit-reporter/lib/spec-junit-reporter.js +++ /dev/null @@ -1,36 +0,0 @@ -// This code combines the Mocha spec and junit outputs with a dynamically allocated directory for junit output - -const mocha = require( 'mocha' ); -const MochaJUnitReporter = require( 'mocha-junit-reporter' ); -const Spec = mocha.reporters.Spec; -const utils = mocha.utils; -const inherits = utils.inherits; - -let reportDir = './reports'; - -if ( process.env.TEMP_ASSET_PATH ) { - reportDir = `${ process.env.TEMP_ASSET_PATH }/reports`; -} -const reportName = reportDir + '/junit_' + new Date().getTime().toString() + '.xml'; - -/** - * Expose `SpecJUnit`. - */ - -exports = module.exports = SpecJUnit; - -/** - * Initialize a new `SpecJUnit` test reporter. - * @param {Object} runner Test runner object, handled implicitly by mocha - */ -function SpecJUnit( runner ) { - // 'mocha-junit-reporter' attaches itself to mocha when the object is created - // eslint-disable-next-line no-new - new MochaJUnitReporter( runner, { reporterOptions: { mochaFile: reportName } } ); - Spec.call( this, runner ); -} - -/** - * Inherit from Spec and JUnit prototypes. - */ -inherits( SpecJUnit, Spec ); diff --git a/packages/spec-junit-reporter/package.json b/packages/spec-junit-reporter/package.json deleted file mode 100644 index 4dd1c09941cf2..0000000000000 --- a/packages/spec-junit-reporter/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "spec-junit-reporter", - "version": "0.0.1", - "description": "Mocha reporter that combines the default spec output with an junit.xml file in a dynamically allocated directory.", - "main": "index.js", - "author": "Automattic Inc.", - "homepage": "https://github.com/Automattic/wp-calypso", - "license": "GPL-2.0-or-later", - "repository": { - "type": "git", - "url": "git+https://github.com/Automattic/wp-calypso.git", - "directory": "packages/spec-junit-reporter" - }, - "bugs": "https://github.com/Automattic/wp-calypso/issues", - "private": true, - "peerDependencies": { - "mocha": "^10.4.0", - "mocha-junit-reporter": "^2.2.1" - }, - "devDependencies": { - "@automattic/calypso-typescript-config": "workspace:^" - } -} diff --git a/packages/spec-junit-reporter/tsconfig.json b/packages/spec-junit-reporter/tsconfig.json deleted file mode 100644 index 4603abc9c6144..0000000000000 --- a/packages/spec-junit-reporter/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "@automattic/calypso-typescript-config/js-package.json" -} diff --git a/packages/spec-xunit-reporter/index.js b/packages/spec-xunit-reporter/index.js deleted file mode 100755 index 0d8393d83903d..0000000000000 --- a/packages/spec-xunit-reporter/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require( './lib/spec-xunit-reporter.js' ); diff --git a/packages/spec-xunit-reporter/lib/spec-xunit-reporter.js b/packages/spec-xunit-reporter/lib/spec-xunit-reporter.js deleted file mode 100644 index bc7c358c82b54..0000000000000 --- a/packages/spec-xunit-reporter/lib/spec-xunit-reporter.js +++ /dev/null @@ -1,35 +0,0 @@ -// This code combines the Mocha spec and xunit outputs with a dynamically allocated directory for xunit output - -const mocha = require( 'mocha' ); -const Spec = mocha.reporters.Spec; -const XUnit = mocha.reporters.XUnit; -const utils = mocha.utils; -const inherits = utils.inherits; - -let reportDir = './reports'; - -if ( process.env.TEMP_ASSET_PATH ) { - reportDir = `${ process.env.TEMP_ASSET_PATH }/reports`; -} -const reportName = reportDir + '/xunit_' + new Date().getTime().toString() + '.xml'; - -/** - * Expose `SpecXUnit`. - */ - -exports = module.exports = SpecXUnit; - -/** - * Initialize a new `SpecXUnit` test reporter. - * @param {Object} runner Test runner object, handled implicitly by mocha - */ -function SpecXUnit( runner ) { - Spec.call( this, runner ); - XUnit.call( this, runner, { reporterOptions: { output: reportName } } ); -} - -/** - * Inherit from Spec and XUnit prototypes. - */ -inherits( SpecXUnit, Spec ); -inherits( SpecXUnit, XUnit ); diff --git a/packages/spec-xunit-reporter/package.json b/packages/spec-xunit-reporter/package.json deleted file mode 100644 index 8a8695afc1ab3..0000000000000 --- a/packages/spec-xunit-reporter/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "spec-xunit-reporter", - "version": "0.0.1", - "description": "Mocha reporter that combines the default spec output with an xunit.xml file in a dynamically allocated directory.", - "main": "index.js", - "author": "Automattic Inc.", - "homepage": "https://github.com/Automattic/wp-calypso", - "license": "GPL-2.0-or-later", - "repository": { - "type": "git", - "url": "git+https://github.com/Automattic/wp-calypso.git", - "directory": "packages/spec-xunit-reporter" - }, - "bugs": "https://github.com/Automattic/wp-calypso/issues", - "private": true, - "peerDependencies": { - "mocha": "^10.4.0" - }, - "devDependencies": { - "@automattic/calypso-typescript-config": "workspace:^" - } -} diff --git a/packages/spec-xunit-reporter/tsconfig.json b/packages/spec-xunit-reporter/tsconfig.json deleted file mode 100644 index 4603abc9c6144..0000000000000 --- a/packages/spec-xunit-reporter/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "@automattic/calypso-typescript-config/js-package.json" -} diff --git a/yarn.lock b/yarn.lock index d908d50d6e439..5e9160680ac6e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -29838,27 +29838,6 @@ __metadata: languageName: node linkType: hard -"spec-junit-reporter@workspace:packages/spec-junit-reporter": - version: 0.0.0-use.local - resolution: "spec-junit-reporter@workspace:packages/spec-junit-reporter" - dependencies: - "@automattic/calypso-typescript-config": "workspace:^" - peerDependencies: - mocha: ^10.4.0 - mocha-junit-reporter: ^2.2.1 - languageName: unknown - linkType: soft - -"spec-xunit-reporter@workspace:packages/spec-xunit-reporter": - version: 0.0.0-use.local - resolution: "spec-xunit-reporter@workspace:packages/spec-xunit-reporter" - dependencies: - "@automattic/calypso-typescript-config": "workspace:^" - peerDependencies: - mocha: ^10.4.0 - languageName: unknown - linkType: soft - "specificity@npm:^0.4.1": version: 0.4.1 resolution: "specificity@npm:0.4.1"