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

feat: use peerDeps for LWC #386

Closed
wants to merge 2 commits into from
Closed
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
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,14 @@

Run Jest against Lightning web components in a Salesforce DX workspace environment.

## Versions

To test against the latest Salesforce production instances, use the npm tag appropriate for the current release, e.g.:

```
yarn add -D @salesforce/sfdx-lwc-jest@winter22
yarn add -D @salesforce/sfdx-lwc-jest@spring22
```

The npm `latest` tag corresponds to the latest version of this repo, not necessarily Salesforce production versions.

To see a full list of available versions, and the tag that maps to the corresponding Salesforce release, see [the list of `npm` package versions](https://www.npmjs.com/package/@salesforce/sfdx-lwc-jest?activeTab=versions).

## Installation

Add this project as a devDependency:
Add this project, `@lwc/engine-dom`, `@lwc/engine-server`, `@lwc/compiler`, and `@lwc/synthetic-shadow`, and `@lwc/jest-preset` as `devDependencies`:

```bash
yarn add -D @salesforce/sfdx-lwc-jest
yarn add -D @salesforce/sfdx-lwc-jest @lwc/engine-dom \
@lwc/engine-server @lwc/compiler @lwc/synthetic-shadow \
@lwc/jest-preset
```

Update your project's unit testing script in `package.json` to execute `sfdx-lwc-jest`:
Expand All @@ -40,6 +29,19 @@ Update your project's unit testing script in `package.json` to execute `sfdx-lwc

Alternatively, you can globally install the package and run directly from the command line.

## Versions

To test against the latest Salesforce production instances, use the npm tag appropriate for the current release when installing `@lwc/engine-dom`, `@lwc/engine-server`, `@lwc/compiler`, and `@lwc/synthetic-shadow`, e.g.:

```
yarn add -D @lwc/engine-dom@winter24
yarn add -D @lwc/engine-dom@spring24
```

The npm `latest` tag corresponds to the latest version of this repo, not necessarily Salesforce production versions.

To see a full list of available versions, and the tag that maps to the corresponding Salesforce release, see [the list of `npm` package versions](https://www.npmjs.com/package/@lwc/engine-dom?activeTab=versions).

## Usage

```
Expand Down
23 changes: 9 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,27 @@
"test": "jest"
},
"dependencies": {
"@lwc/compiler": "7.1.2",
"@lwc/engine-dom": "7.1.2",
"@lwc/engine-server": "7.1.2",
"@lwc/jest-preset": "16.1.0",
"@lwc/jest-resolver": "16.1.0",
"@lwc/jest-serializer": "16.1.0",
"@lwc/jest-transformer": "16.1.0",
"@lwc/module-resolver": "7.1.2",
"@lwc/synthetic-shadow": "7.1.2",
"@lwc/wire-service": "7.1.2",
"@salesforce/wire-service-jest-util": "4.1.4",
"@salesforce/wire-service-jest-util": "^4.1.4",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using a caret to avoid the need to keep bumping this project when the other one changes.

"fast-glob": "^3.3.2",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"yargs": "~17.7.2"
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"yargs": "^17.7.2"
},
"devDependencies": {
"@babel/core": "^7.24.4",
"@babel/eslint-parser": "^7.24.1",
"@babel/plugin-proposal-decorators": "^7.24.1",
"@lwc/jest-preset": "^16.1.0",
"eslint": "^8.57.0",
"husky": "^9.0.11",
"isbinaryfile": "^5.0.2",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5"
},
"peerDependencies": {
"@lwc/engine-dom": ">= 5",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Matching the current peerDep for @lwc/jest-preset on @lwc/engine-dom.

"@lwc/jest-preset": ">= 16"
},
"volta": {
"node": "20.12.1",
"yarn": "1.22.22"
Expand Down
21 changes: 0 additions & 21 deletions scripts/upgrade-lwc.sh

This file was deleted.

Loading