Skip to content

Commit 65bd345

Browse files
author
Takashi Kato
committed
Bump version
Use chai 5.0.0, @mswjs/interceptors 0.25.13
1 parent 2e09011 commit 65bd345

File tree

8 files changed

+212
-11425
lines changed

8 files changed

+212
-11425
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ export default class extends Controller {
3939
controllers/clear_controller.spec.js
4040

4141
```javascript
42+
import { assert } from "chai"
4243
import { Application } from "@hotwired/stimulus"
4344
import ClearController from 'controllers/clear_controller'
4445

45-
const assert = chai.assert;
4646
const html = `<div data-controller="clear">
4747
<input id="target" type="text" value="foo" data-clear-target="clear">
4848
<button data-action="clear#clear">test</button>

app/views/importmap_mocha/test/index.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<% if Rails.application.config.importmap_mocha_scripts.size > 0 %>
77
<%= javascript_include_tag *Rails.application.config.importmap_mocha_scripts %>
88
<% end %>
9-
<%= javascript_include_tag 'mocha', 'chai' %>
9+
<%= javascript_include_tag 'mocha' %>
1010
<%= stylesheet_link_tag 'mocha' %>
1111
<%= javascript_importmap_tags 'importmap_mocha' %>
1212
<meta name="viewport" content="width=device-width, initial-scale=1">

config/importmap.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
pin "@mswjs/interceptors", to: "@mswjs--interceptors.js"
44
pin "@mswjs/interceptors/presets/browser" , to: "@mswjs--interceptors--presets--browser.js"
5+
pin "chai", to: "chai.js"
56

67
pin "@open-draft/logger", to: "@open-draft--logger.js" # @0.3.0
78
pin "is-node-process", to: "is-node-process.js" # @1.2.0

importmap_mocha-rails.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
2020
end
2121

2222
spec.add_dependency 'rails', '~> 7.0'
23+
spec.add_dependency 'importmap-rails'
2324
end

lib/importmap_mocha/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module ImportmapMocha
4-
VERSION = '0.2.0'
4+
VERSION = '0.3.0'
55
end

vendor/javascripts/@mswjs--interceptors--presets--browser.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -548,13 +548,20 @@ function parseJson(data) {
548548
}
549549

550550
// src/utils/responseUtils.ts
551-
var responseStatusCodesWithoutBody = [204, 205, 304];
551+
var RESPONSE_STATUS_CODES_WITHOUT_BODY = /* @__PURE__ */ new Set([
552+
101,
553+
103,
554+
204,
555+
205,
556+
304
557+
]);
558+
function isResponseWithoutBody(status) {
559+
return RESPONSE_STATUS_CODES_WITHOUT_BODY.has(status);
560+
}
552561

553562
// src/interceptors/XMLHttpRequest/utils/createResponse.ts
554563
function createResponse(request, body) {
555-
const responseBodyOrNull = responseStatusCodesWithoutBody.includes(
556-
request.status
557-
) ? null : body;
564+
const responseBodyOrNull = isResponseWithoutBody(request.status) ? null : body;
558565
return new Response(responseBodyOrNull, {
559566
status: request.status,
560567
statusText: request.statusText,

vendor/javascripts/@mswjs--interceptors.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,18 @@ function decodeBuffer(buffer, encoding) {
212212
const decoder = new TextDecoder(encoding);
213213
return decoder.decode(buffer);
214214
}
215+
216+
// src/utils/responseUtils.ts
217+
var RESPONSE_STATUS_CODES_WITHOUT_BODY = /* @__PURE__ */ new Set([
218+
101,
219+
103,
220+
204,
221+
205,
222+
304
223+
]);
224+
function isResponseWithoutBody(status) {
225+
return RESPONSE_STATUS_CODES_WITHOUT_BODY.has(status);
226+
}
215227
export {
216228
BatchInterceptor,
217229
IS_PATCHED_MODULE,
@@ -221,5 +233,6 @@ export {
221233
deleteGlobalSymbol,
222234
encodeBuffer,
223235
getCleanUrl,
224-
getGlobalSymbol
236+
getGlobalSymbol,
237+
isResponseWithoutBody
225238
};

vendor/javascripts/chai.js

Lines changed: 182 additions & 11417 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)