Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix peer deps, remove redundant deps #1046

Merged
merged 21 commits into from
Jul 5, 2024
Merged

Fix peer deps, remove redundant deps #1046

merged 21 commits into from
Jul 5, 2024

Conversation

delatrie
Copy link
Collaborator

@delatrie delatrie commented Jul 5, 2024

Peer dependencies (Yarn PnP and version warnings support)

The main focus of this PR is to improve Yarn PnP support by properly declaring all runtime dependencies in manifests.

Many Allure packages import packages of the test frameworks. Those could be top-level packages (vitest, mocha), or packages, that are transitive dependencies of some top-level package (e.g., allure-vitest imports @vitest/runner, which is a transitive dependency of vitest).

Yarn PnP requires such packages to be present in the manifest. E.g., @vitest/runner must be declared as a dependency of allure-vitest. Otherwise, Yarn PnP considers it a ghost dependency and fails the import.

Such dependencies are parts of the execution runtime and are installed separately. Therefore, in this PR those are declared as peer dependencies. It prevents unwanted isolation between the version that comes with the test framework (e.g., after yarn install vitest) and the version that otherwise would've been chosen by our package (e.g., after yarn install allure-vitest).

Additionally, is allows to show a warning in case the user installs an unsupported version of the test framework.

Additionally, some Allure packages don't import test framework packages at runtime while are still intended to be run in the test framework environment (e.g., allure-jasmine doesn't import Jasmine packages at runtime). The PR declares such dependencies as optional peer dependencies. It allows users to introduce such packages in any way they find suitable (e.g., Jasmin, although not recommended, could be installed globally) while keeping the unsupported version warnings.

The downside is that Yarn PnP users have to install all non-optional peer dependencies explicitly. I.e., instead of yarn add -D vitest allure-vitest they have to run yarn add -D vitest @vitest/runner allure-vitest.

Peer dependencies table

Note

I've specified version ranges as >=min-version. That allows users to use newer versions of test frameworks, which often don't break anything, without waiting for us to update the manifest. Alternatively, we may cap the ranges with the current major versions. That will still allow users to update test frameworks but will show them the version mismatch warning until we release the version with updated peer dependencies.

Allure Package Peer Dependency Min Version Optional Optionality comment
allure-codeceptjs codeceptjs 2.3.6 no Unconditional import
allure-cucumberjs @cucumber/cucumber 10.8.0 no Unconditional import
@cucumber/messages 24.1.0 no Unconditional import
allure-cypress cypress 12.17.4 yes Type imports only; allow global install
allure-jasmine jasmine 2.7.0 yes Depends implicitly via the jasmine namespace; allow global install
allure-jest jest 28.0.0 yes No imports; allow global install
jest-cli 28.0.0 yes No imports; allow global install
jest-environment-jsdom 28.0.0 yes Choise between jsdom and node
jest-environment-node 28.0.0 yes Choise between jsdom and node
allure-js-commons allure-playwright workspace yes Conditional import (autoconfig)
allure-mocha mocha 6.2.0 no Unconditional import
allure-playwright @playwright/test 1.36.0 no Unconditional import
allure-vitest @vitest/runner 1.3.0 no Unconditional import
vitest 1.3.0 no Unconditional import
newman-reporter-allure newman 3.5.0 yes Type imports only; allow global install

Redundant dependencies

The PR removes the following redundant dependencies:

  • allure-codeceptjs: expect, ts-node`
  • allure-cucumberjs: @cucumber/gherkin, @cucumber/gherkin-streams, @cucumber/gherkin-utils, @cucumber/message-streams, @types/chai, @types/chai-like, @types/chai-things, @types/glob, @types/sinon, chai, chai-like, chai-things, sinon, ts-node.
  • allure-cypress: @types/glob, @types/mocha, enquirer, ts-node
  • allure-jasmine: tslib
  • allure-jest: @jest-core, @types/source-map-support, source-map-support, ts-node, tslib
  • allure-js-commons: @types/source-map-support, expect, source-map-support, ts-node, tslib
  • allure-mocha: @types-chai, chai, chai-like, chai-things, source-map-support, ts-node, tslib
  • allure-playwright: -
  • allure-vitest: vite
  • newman-reporter-allure: @types/source-map-support, expect, source-map-support, ts-node, tslib

Other changes

  • allure-codeceptjs: scenario names in skip test are now not duplicated
  • allure-mocha: missing fixtures in old versions of mocha
  • allure-codeceptjs: fix babel JSON syntax
  • allure-mocha: bump mocha to 10.6.0
  • allure-jasmine: bump jasmine to 5.1.0

@delatrie delatrie added the type:dependencies Pull requests that update a dependency file label Jul 5, 2024
@github-actions github-actions bot added theme:api Javascript API related issue theme:mocha Mocha related issue theme:jest Jest related issue theme:cucumberjs CucumberJS related issue theme:jasmine Jasmine related issue theme:playwright theme:newman theme:codeceptjs theme:vitest labels Jul 5, 2024
@delatrie delatrie marked this pull request as ready for review July 5, 2024 08:33
delatrie added 18 commits July 5, 2024 13:10
@cucumber/cucumber 10.8.0+ is required due to the usage of `world`.
The lower bound of @cucumber/messages is 24.1.0 because
that's the exact version [email protected] pins
We support cypress 12.17.4 or greater is supported.
Older versions use webpack 4, which can't handle null coalescing operator
We support jasmine 2.7.0+ (since async support)
We support jest 28+ since we rely on the new environment
constructor signature introduced in 28.0.0
We support playwright 1.36.0+ because of suite.allTests
Vitest 1.3.0+ is supported. We rely on the ability to provide a
reporter's options via the config file which was introduced in 1.3.0
Newman version 3.5.0+ is supported
@epszaw epszaw force-pushed the dependency-fixes branch from 5904e5a to c9ba584 Compare July 5, 2024 11:11
@baev baev merged commit 7a01d04 into main Jul 5, 2024
8 checks passed
@baev baev deleted the dependency-fixes branch July 5, 2024 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:api Javascript API related issue theme:codeceptjs theme:cucumberjs CucumberJS related issue theme:jasmine Jasmine related issue theme:jest Jest related issue theme:mocha Mocha related issue theme:newman theme:playwright theme:vitest type:dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants