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

chore(release): v0.3.0 #120

Merged
merged 53 commits into from
Mar 31, 2024
Merged

chore(release): v0.3.0 #120

merged 53 commits into from
Mar 31, 2024

Conversation

diego-aquino
Copy link
Member

@diego-aquino diego-aquino commented Mar 30, 2024

- docs: improve installation commands in `README.md`
- docs: center package manager names
- chore(ci): disable fail-fast
- build(#zimic): disable build minification
- build(root): upgrade turbo to latest version
- fix(#zimic): add missing error names
- feat(#zimic): improve mismatched platform error handling
- test(#zimic): improve error assertions
- refactor(#release): consider release commits as `chore`
### Refactor
- [#zimic] Improve internal class names
  - `InternalHttpInterceptor` -> `HttpInterceptor`
  - `InternalHttpInterceptorWorker` -> `HttpInterceptorWorker`
  - `InternalHttpRequestTracker` -> `HttpRequestTracker`

### Chore
- [zimic-test-client, #release, #zimic] Removed unused file references
### Documetantion
- [examples] Created example projects for Vitest, Jest, JSDOM and
Node.js,

### CI/CD
- Included examples in post-release checks, ensuring that new versions
do not result in errors.

Closes #34,
### Fixes
- [examples-vitest-browser] Ignored postinstall errors, preventing build
problems on GitHub Actions.
### Fixes
- [ci] Escaped newlines in turbo commands of post-released checks.
### Fixes
- [examples] Enabled vm modules in Jest examples, required because Zimic
uses dynamic imports.
- [ci] Restricted remote Zimic versions to zimic-test-client and
examples.
### FIxes
- [#zimic] Fixed relative paths on published `README.md` files (e.g.
`[link](./example)` -> `[link](../../example)`).
### Documentation
- [#zimic] Renamed `route` terms to `path`, to keep consistency with the
current types, methods, parameters and documentation.
### Refactoring
- [#zimic] Renamed request tracker tests to match their class names.

### Documentation
- [#zimic] Added comments to expected TypeScript errors for clarity.
### Features
- [#zimic] Added support to request search params.

### Tests
- [zimic-test-client] Extended the default tests to also verify search
params.

Closes #84.
### Build
- [root] Upgrade `vite` and `@types/node` to their latest versions.
- [root] Remove unnecessary `@types/node` from packages that do not need
it.

Also solves https://github.com/diego-aquino/zimic/security/dependabot/1.
### Refactoring
- [#zimic] Move generic HTTP implementations to a dedicated directory,
including search params.
- [#zimic] Remove an unnecessary internal type from exports.
- [#zimic] Simplified search param schema exports.
### Features
- [#zimic] Added support to request and response headers in
interceptors.

Closes #85.
- perf(root): improve local and ci test concurrency
### Documentation
- [#zimic] Added the API changes to `README.md`, including HTTP headers,
HTTP search params and JSON values.

Closes #23.
### Features
- [#zimic] Added support to restricting request trackers by exact or
partial search params.
- [#zimic] Included `HttpHeadersInit` and `HttpSearchParamsInit` to the
type exports.

```ts
const user = users[0];

const listTracker = authInterceptor
  .get('/users')
  .with({
    searchParams: { name: user.name },
  })
  .respond({
    status: 200,
    body: [user],
  });

const response = await listUsers({ name: user.name });
expect(response.status).toBe(200);

const returnedUsers = (await response.json()) as User[];
expect(returnedUsers).toEqual([user]);
```

Closes #13.
### Features
- [#zimic] Created a new method `clear()` to clear all declared
responses, restrictions and intercepted requests and responses from
request trackers.
- BREAKING CHANGE:
[`tracker.bypass()`](https://github.com/diego-aquino/zimic#trackerbypass)
no longer clears the intercepted requests and responses from the
tracker.

Closes #100.
### Features
- [#zimic] Added support to restrict request trackers by HTTP headers.
- [#zimic] Added support to compare equality and containment of HTTP
headers.

### Fixes
- [#zimic] Fixed the semantics of search param comparisons. Now
`param1.contains(param2)` returns `true` only if all key-value pairs of
`param2` are present in `param1`, regardless of `param1` having more
key-pairs than `param2`. The previous behavior was that
`param1.contains(param2)` would return `true` only if all key-value
pairs of `param1` were present in `param2`, which is not correct because
the semantics are reversed.

```ts
const creationTracker = authInterceptor
  .post('/users')
  .with({
    headers: { 'content-type': 'application/json' },
  })
  .respond((request) => {
    const user: User = {
      id: crypto.randomUUID(),
      name: request.body.name,
      email: request.body.email,
    };

    return {
      status: 201,
      body: user,
    };
  });

const response = await createUser(creationPayload);
expect(response.status).toBe(201);
```

Closes #86.
This pull request is migrating the following changes from `v0.2.x` to
`canary`:

* [fix: bypassed
requests](#105) (#104)
### Features
- [#zimic] Added support to restrict request trackers by body.

```ts
const creationTracker = authInterceptor
  .post('/users')
  .with({
    body: creationPayload,
  })
  .respond((request) => {
    const user: User = {
      id: crypto.randomUUID(),
      name: request.body.name,
      email: request.body.email,
    };

    return {
      status: 201,
      body: user,
    };
  });

const response = await createUser(creationPayload);
expect(response.status).toBe(201);
```

### Refactoring
- [#zimic] Simplified request and response body schemas.
- Unified `HttpInterceptorSchema.RequestBody` and
`HttpInterceptorSchema.ResponseBody` into `HttpInterceptorSchema.Body`,
as the previous `RequestBody` and `ResponseBody` had the same semantics.
- [#zimic] Improved HTTP interceptor test scenarios, following
real-world cases more closely for each method.
Closes #12.
### Features
- [#zimic] Added the utility types `JSONCompatible` and
`JSONSerialized`.
- [#zimic] Added strict JSON validation to interceptor schemas. Since
this is a breaking change, see the [Migration
guide](#106 (comment))
to enable the strict validation!

Closes #106.
### Refactoring
- [#zimic] Simplified and improved the type exports. Check out the
[Migration
guide](#113 (comment))
for more information.

### Fixes
- [#zimic] Extended `JSONSerialized` to correctly exclude functions with
arguments from the result type. Previously, only functions that had no
arguments were excluded.

Closes #113.
### Build
- Upgraded most of dependencies and dev dependencies. It was not
possible to upgrade to the latest `vitest` version due to concurrency
problems happening after `1.3.0`, so I updated it to `1.2.2`.
### Features
- [#zimic] Added support to TypeScript 5.4.
### Documentation
- [#zimic] Improved the examples using headers and search params.
- [#zimic] Added a link to the examples section to the headline.
- [#zimic] Documented the new APIs `tracker.with(restriction)` and
`tracker.clear()`.
- [#zimic] Improved notes using [Markdown
Alerts](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts).

Closes #24.
### CI/CD
- Added matrices to test Zimic's compatibility with Node.js 18 and 20
and TypeScript 4.7 to 5.4.

Closes #68;
### CI/CD
- Declared typescript versions as strings, making sure that
`typescript@5.0` is treated as such and not `typescript@5`.

Complement to #68.
@diego-aquino diego-aquino added this to the v0.3.0 milestone Mar 30, 2024
@diego-aquino diego-aquino self-assigned this Mar 30, 2024
@diego-aquino diego-aquino merged commit 1ca55b5 into main Mar 31, 2024
13 checks passed
@diego-aquino diego-aquino deleted the release/v0.3.0 branch March 31, 2024 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant