Skip to content

Commit

Permalink
update deps (#229)
Browse files Browse the repository at this point in the history
* Update most deps (except browserify and husky)

* Mark the timers module used in fake-timers as external (thus not included)

* fix linting issues after upgrades of common linting settings

* Use Node 22 in runners

* Make a link to the fake-timers docs

* Revert "Use Node 22 in runners"

This reverts commit 9db8b59.

Tests using FileReader fails for whatever reason. Not sure how they
worked to begin with in Node 16? It's JSDOM providing the API anyway.
  • Loading branch information
fatso83 authored Sep 12, 2024
1 parent d850163 commit 0b0eef1
Show file tree
Hide file tree
Showing 5 changed files with 1,355 additions and 1,336 deletions.
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# nise (偽)
# nise (偽)

fake XHR and Server

Expand Down Expand Up @@ -219,7 +219,7 @@ This function also calls `useFakeXMLHttpRequest()`.

#### `var server = fakeServerWithClock.create();`

Creates a server that also manages fake timers.
Creates a server that also manages [fake timers](https://github.com/sinonjs/fake-timers).

This is useful when testing `XHR` objects created with e.g. jQuery 1.3.x, which uses a timer to poll the object for completion, rather than the usual `onreadystatechange`.

Expand Down
6 changes: 6 additions & 0 deletions lib/fake-server/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ describe("sinonFakeServer", function () {
"fakeServer.create should accept 'autoRespond' setting",
);
});

it("allows the 'autoRespondAfter' setting", function () {
var server = sinonFakeServer.create({
autoRespondAfter: 500,
Expand All @@ -63,6 +64,7 @@ describe("sinonFakeServer", function () {
"fakeServer.create should accept 'autoRespondAfter' setting",
);
});

it("allows the 'respondImmediately' setting", function () {
var server = sinonFakeServer.create({
respondImmediately: true,
Expand All @@ -72,6 +74,7 @@ describe("sinonFakeServer", function () {
"fakeServer.create should accept 'respondImmediately' setting",
);
});

it("allows the 'fakeHTTPMethods' setting", function () {
var server = sinonFakeServer.create({
fakeHTTPMethods: true,
Expand All @@ -81,6 +84,7 @@ describe("sinonFakeServer", function () {
"fakeServer.create should accept 'fakeHTTPMethods' setting",
);
});

it("allows the 'unsafeHeadersEnabled' setting", function () {
var server = sinon.fakeServer.create({
unsafeHeadersEnabled: false,
Expand All @@ -94,6 +98,7 @@ describe("sinonFakeServer", function () {
"fakeServer.create should accept 'unsafeHeadersEnabled' setting",
);
});

it("does not assign a non-allowlisted setting", function () {
var server = sinonFakeServer.create({
foo: true,
Expand All @@ -103,6 +108,7 @@ describe("sinonFakeServer", function () {
"fakeServer.create should not accept 'foo' settings",
);
});

it("allows the 'legacyRoutes' setting", function () {
var server = sinonFakeServer.create({
legacyRoutes: false,
Expand Down
4 changes: 4 additions & 0 deletions lib/fake-xhr/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2048,6 +2048,7 @@ describe("FakeXMLHttpRequest", function () {

describe("stub XHR", function () {
beforeEach(fakeXhrSetUp);

afterEach(fakeXhrTearDown);

it("returns FakeXMLHttpRequest constructor", function () {
Expand Down Expand Up @@ -2323,6 +2324,7 @@ describe("FakeXMLHttpRequest", function () {
if (typeof ActiveXObject === "undefined") {
describe("missing ActiveXObject", function () {
beforeEach(fakeXhrSetUp);

afterEach(fakeXhrTearDown);

it("does not expose ActiveXObject", function () {
Expand All @@ -2338,6 +2340,7 @@ describe("FakeXMLHttpRequest", function () {
} else {
describe("native ActiveXObject", function () {
beforeEach(fakeXhrSetUp);

afterEach(fakeXhrTearDown);

it("hijacks ActiveXObject", function () {
Expand Down Expand Up @@ -2412,6 +2415,7 @@ describe("FakeXMLHttpRequest", function () {

describe("with native XHR", function () {
beforeEach(fakeXhrSetUp);

afterEach(fakeXhrTearDown);

it("replaces global XMLHttpRequest", function () {
Expand Down
Loading

0 comments on commit 0b0eef1

Please sign in to comment.