Skip to content

Commit

Permalink
chore: merge "main" into "feat/ws-sync-handlers"
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito committed Oct 26, 2023
2 parents f1ff76a + 1d1fbca commit ed70542
Show file tree
Hide file tree
Showing 75 changed files with 1,041 additions and 464 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/02-issue-nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ body:
options:
- label: I'm using the [latest](https://github.com/mswjs/msw/releases/latest) `msw` version
required: true
- label: I'm using Node.js version 14 or higher
- label: I'm using Node.js version 18 or higher
required: true

- type: input
attributes:
label: Node.js version
description: Specify which Node.js version you're using (`node -v`).
placeholder: i.e. v16.14.0
placeholder: i.e. v18.14.0
validations:
required: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ts: ['4.4', '4.5', '4.6', '4.7', '4.8', '4.9', '5.0', '5.1', '5.2']
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2']
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
29 changes: 22 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
> **MSW 2.0 is finally here! 🎉** Read the [Release notes](https://github.com/mswjs/msw/releases/tag/v2.0.0) and please follow the [**Migration guidelines**](https://mswjs.io/docs/migrations/1.x-to-2.x) to upgrade. If you're having any questions while upgrading, please reach out in our [Discord server](https://kettanaito.com/discord).
>
> We've also recorded the most comprehensive introduction to MSW ever. Learn how to mock APIs like a pro in our official video course:
<a href="https://egghead.io/courses/mock-rest-and-graphql-apis-with-mock-service-worker-8d471ece?af=8mci9b" target="_blank">
<img src="media/egghead-banner.png" alt="Mock REST and GraphQL APIs with Mock Service Worker" />
</a>

<br />
<br />

<p align="center">
Expand All @@ -21,11 +30,13 @@

<br />

<br />

## Features

- **Seamless**. A dedicated layer of requests interception at your disposal. Keep your application's code and tests unaware of whether something is mocked or not.
- **Deviation-free**. Request the same production resources and test the actual behavior of your app. Augment an existing API, or design it as you go when there is none.
- **Familiar & Powerful**. Use [Express](https://github.com/expressjs/express)-like routing syntax to capture requests. Use parameters, wildcards, and regular expressions to match requests, and respond with necessary status codes, headers, cookies, delays, or completely custom resolvers.
- **Familiar & Powerful**. Use [Express](https://github.com/expressjs/express)-like routing syntax to intercept requests. Use parameters, wildcards, and regular expressions to match requests, and respond with necessary status codes, headers, cookies, delays, or completely custom resolvers.

---

Expand All @@ -38,8 +49,7 @@
This README will give you a brief overview on the library but there's no better place to start with Mock Service Worker than its official documentation.

- [Documentation](https://mswjs.io/docs)
- [**Getting started**](https://mswjs.io/docs/getting-started/install)
- [Recipes](https://mswjs.io/docs/recipes)
- [**Getting started**](https://mswjs.io/docs/getting-started)
- [FAQ](https://mswjs.io/docs/faq)

## Examples
Expand All @@ -48,12 +58,12 @@ This README will give you a brief overview on the library but there's no better

## Browser

- [Learn more about using MSW in a browser](https://mswjs.io/docs/getting-started/integrate/browser)
- [Learn more about using MSW in a browser](https://mswjs.io/docs/integrations/browser)
- [`setupWorker` API](https://mswjs.io/docs/api/setup-worker)

### How does it work?

In-browser usage is what sets Mock Service Worker apart from other tools. Utilizing the [Service Worker API](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API), which can intercept requests for the purpose of caching, Mock Service Worker responds to captured requests with your mock definition on the network level. This way your application knows nothing about the mocking.
In-browser usage is what sets Mock Service Worker apart from other tools. Utilizing the [Service Worker API](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API), which can intercept requests for the purpose of caching, Mock Service Worker responds to intercepted requests with your mock definition on the network level. This way your application knows nothing about the mocking.

**Take a look at this quick presentation on how Mock Service Worker functions in a browser:**

Expand Down Expand Up @@ -101,7 +111,7 @@ Performing a `GET https://github.com/octocat` request in your application will r
## Node.js

- [Learn more about using MSW in Node.js](https://mswjs.io/docs/getting-started/integrate/node)
- [Learn more about using MSW in Node.js](https://mswjs.io/docs/integrations/node)
- [`setupServer` API](https://mswjs.io/docs/api/setup-server)

### How does it work?
Expand Down Expand Up @@ -175,7 +185,7 @@ it('displays the list of recent posts', async () => {
})
```

> Don't get overwhelmed! We've prepared a step-by-step [**Getting started**](https://mswjs.io/docs/getting-started/install) tutorial that you can follow to learn how to integrate Mock Service Worker into your project.
> Don't get overwhelmed! We've prepared a step-by-step [**Getting started**](https://mswjs.io/docs/getting-started) tutorial that you can follow to learn how to integrate Mock Service Worker into your project.
Despite the API being called `setupServer`, there are no actual servers involved! The name was chosen for familiarity, and the API was designed to resemble operating with an actual server.

Expand Down Expand Up @@ -203,6 +213,11 @@ Mock Service Worker is trusted by hundreds of thousands of engineers around the
</picture>
</a>
</td>
<td>
<a href="https://www.codacy.com/" target="_blank">
<img src="media/sponsors/codacy.svg" alt="Codacy" height="64" />
</a>
</td>
</tr>
</table>

Expand Down
Binary file added media/egghead-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions media/sponsors/codacy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions media/sponsors/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "msw",
"version": "0.0.0-fetch.rc-19",
"version": "2.0.0",
"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 @@ -123,8 +123,8 @@
"chalk": "^4.1.2",
"chokidar": "^3.4.2",
"formdata-node": "4.4.1",
"graphql": "^15.0.0 || ^16.7.0",
"headers-polyfill": "^3.2.3",
"graphql": "^16.8.1",
"headers-polyfill": "^4.0.1",
"inquirer": "^8.2.0",
"is-node-process": "^1.2.0",
"js-levenshtein": "^1.1.6",
Expand All @@ -143,7 +143,7 @@
"@commitlint/cli": "^16.1.0",
"@commitlint/config-conventional": "^16.0.0",
"@open-draft/test-server": "^0.4.2",
"@ossjs/release": "^0.7.2",
"@ossjs/release": "^0.8.0",
"@playwright/test": "^1.30.0",
"@swc/core": "^1.3.35",
"@swc/jest": "^0.2.24",
Expand Down Expand Up @@ -192,7 +192,7 @@
"webpack-http-server": "^0.5.0"
},
"peerDependencies": {
"typescript": ">= 4.4.x <= 5.2.x"
"typescript": ">= 4.7.x <= 5.2.x"
},
"peerDependenciesMeta": {
"typescript": {
Expand Down
61 changes: 47 additions & 14 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ed70542

Please sign in to comment.