Skip to content

Commit

Permalink
Merge branch 'main' into fix/use-cookie-directly
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito committed Nov 7, 2024
2 parents 20e0b2a + 078fa08 commit 0388d61
Show file tree
Hide file tree
Showing 91 changed files with 5,618 additions and 191 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/auto.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: auto

on: [push]

jobs:
cancel-previous-workflows:
runs-on: macos-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/compat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/lock-closed-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: locked-closed-issues

on:
schedule:
- cron: '0 0 * * *'

permissions:
issues: write

jobs:
action:
runs-on: macos-latest
steps:
- uses: dessant/lock-threads@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
issue-inactive-days: '14'
issue-lock-reason: ''
process-only: 'issues'
60 changes: 60 additions & 0 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: release-preview

on:
pull_request_review:
types: [submitted]
workflow_dispatch:

jobs:
check:
# Trigger the permissions check whenever someone approves a pull request.
# They must have the write permissions to the repo in order to
# trigger preview package publishing.
if: github.event_name == 'workflow_dispatch' || github.event.review.state == 'approved'
runs-on: ubuntu-latest
outputs:
has-permissions: ${{ steps.checkPermissions.outputs.require-result }}
steps:
- name: Check permissions
id: checkPermissions
uses: actions-cool/check-user-permission@v2
with:
require: 'write'

publish:
# The approving user must pass the permissions check
# to trigger the preview publish.
needs: check
if: github.event_name == 'workflow_dispatch' || needs.check.outputs.has-permissions == 'true'
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.6

- name: Install dependencies
run: pnpm install

- name: Install Playwright browsers
run: pnpm exec playwright install

- name: Lint
run: pnpm lint

- name: Build
run: pnpm build

- name: Tests
run: pnpm test

- name: Publish preview
run: pnpm dlx pkg-pr-new@0.0 publish --compact --pnpm --comment=update
12 changes: 8 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,25 @@ on:
jobs:
release:
runs-on: macos-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_ADMIN_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
always-auth: true
registry-url: https://registry.npmjs.org

- uses: pnpm/action-setup@v4
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.6

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

- name: Set up PNPM
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.6
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/typescript-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand All @@ -37,10 +37,10 @@ jobs:
if: ${{ needs.compare.outputs.latest_version != needs.compare.outputs.rc_version }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ msw-*.tgz
# Smoke test temporary files.
/package.json.copy
/examples

tsconfig.vitest-temp.json
/test/modules/node/node-esm-tests
tsconfig.vitest-temp.json
2 changes: 1 addition & 1 deletion decisions/jest-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

With the introduction of [Mock Service Worker 2.0](https://mswjs.io/blog/introducing-msw-2.0), the library has made a significant step forward in the effort of embracing and promoting web standards. Since that release, its contributors have reported multiple issues with Node.js simply because MSW exposed developers to using standard Node.js APIs.

Betting and advancing the web standards is one of the goals behind this project. One of such standards is ESM. It's the present and the future of JavaScript, and we are planning on switching to ESM-only in the years to come. For that transition to happen, we need to prioritize and, at times, make hard decisions.
Betting on the web standards is one of the goals behind this project. One of such standards is ESM. It's the present and the future of JavaScript, and we are planning on switching to ESM-only in the years to come. For that transition to happen, we need to prioritize and, at times, make hard decisions.

**MSW offers no official support for Jest.** It doesn't mean MSW cannot be used in Jest. We maintain usage examples of both [Jest](https://github.com/mswjs/examples/tree/main/examples/with-jest) and [Jest+JSDOM](https://github.com/mswjs/examples/tree/main/examples/with-jest-jsdom) to attest to that. Although it's necessary to mention that those examples require additional setup to tackle underlying Jest or JSDOM issues.

Expand Down
9 changes: 9 additions & 0 deletions decisions/linting-worker-script.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Linting the worker script

When linting your application, you may encounter warnings or errors originating from the `mockServiceWorker.js` script. Please refrain from opening pull requests to add the `ignore` pragma comments to the script itself.

## Solution

**Make sure that the worker script is ignored by your linting tools**. The worker script isn't a part of your application's code but a static asset. It must be ignored during linting and prettifying in the same way all your static assets in `/public` are ignored. Please configure your tools respectively.

If there are warnings/errors originating from the worker script, it's likely your public directory is not ignored by your linting tools. You may consider ignoring the entire public directory if that suits your project's conventions.
6 changes: 5 additions & 1 deletion decisions/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ MSW uses the [Release](https://github.com/ossjs/release) library to automate its

## Release schedule

The next version of the library releases automatically **every 3 days**.
The next version of **the library releases automatically every day**.

We do our best to choose the optimal release window to accumulate multiple changes under a single release. We do deviate from the release schedule in emergency cases, like when a critical issue has been fixed and needs an immediate release.

> [!IMPORTANT]
> Please do not ping the library maintainers to release a new version of MSW. Be patient and wait for the automated release to happen. Subscribe to any issue or pull request you are interested in, and you will be notified whenever it gets released.
## Preview releases

This repository is configured to **release work-in-progress pull requests** using [okg.pr.new](https://github.com/stackblitz-labs/pkg.pr.new). Once the pull request in question is approved, it will automatically be published to a temporary registry. Follow the instructions in the automated comment to install the work-in-progress version of the package.
13 changes: 5 additions & 8 deletions media/msw-logo-black.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 6 additions & 8 deletions media/msw-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified media/msw-video-thumbnail.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "msw",
"version": "2.4.10",
"version": "2.6.1",
"description": "Seamless REST/GraphQL API mocking library for browser and Node.js.",
"main": "./lib/core/index.js",
"module": "./lib/core/index.mjs",
Expand Down Expand Up @@ -58,6 +58,12 @@
"import": "./lib/core/graphql.mjs",
"default": "./lib/core/graphql.js"
},
"./core/ws": {
"types": "./lib/core/ws.d.ts",
"require": "./lib/core/ws.js",
"import": "./lib/core/ws.mjs",
"default": "./lib/core/ws.js"
},
"./mockServiceWorker.js": "./lib/mockServiceWorker.js",
"./package.json": "./package.json"
},
Expand Down Expand Up @@ -136,8 +142,9 @@
"@bundled-es-modules/cookie": "^2.0.1",
"@bundled-es-modules/statuses": "^1.0.1",
"@bundled-es-modules/tough-cookie": "^0.1.6",
"@inquirer/confirm": "^3.0.0",
"@mswjs/interceptors": "^0.35.8",
"@inquirer/confirm": "^5.0.0",
"@mswjs/interceptors": "^0.36.5",
"@open-draft/deferred-promise": "^2.2.0",
"@open-draft/until": "^2.1.0",
"@types/cookie": "^0.6.0",
"@types/statuses": "^2.0.4",
Expand All @@ -154,6 +161,7 @@
"devDependencies": {
"@commitlint/cli": "^18.4.4",
"@commitlint/config-conventional": "^18.4.4",
"@fastify/websocket": "^8.3.1",
"@open-draft/test-server": "^0.4.2",
"@ossjs/release": "^0.8.1",
"@playwright/test": "^1.48.0",
Expand All @@ -177,6 +185,7 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"express": "^5.0.0",
"fastify": "^4.26.0",
"fs-extra": "^11.2.0",
"fs-teardown": "^0.3.0",
"glob": "^11.0.0",
Expand Down
Loading

0 comments on commit 0388d61

Please sign in to comment.