Skip to content

Commit 53fc806

Browse files
authored
Remove jest dependency (#173)
1 parent 9a1de16 commit 53fc806

15 files changed

+45
-63
lines changed

jest.config.mjs

Lines changed: 0 additions & 8 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"build-cjs": "esbuild --bundle --outfile=dist/index.cjs --platform=node --format=cjs src/index.ts",
4545
"build-esm": "esbuild --bundle --outfile=dist/index.mjs --platform=node --format=esm src/index.ts",
4646
"build-browser": "esbuild --bundle --outfile=dist/index.js --format=esm src/index.ts",
47-
"test": "jest"
47+
"test": "node --import tsx --test test/*.ts"
4848
},
4949
"repository": {
5050
"type": "git",
@@ -67,16 +67,14 @@
6767
},
6868
"homepage": "https://github.com/flickr/flickr-sdk#readme",
6969
"devDependencies": {
70-
"@jest/globals": "^29.7.0",
7170
"@types/node": "^20.8.4",
7271
"esbuild": "^0.19.4",
73-
"esbuild-jest": "^0.5.0",
7472
"flickr-sdk": "file:.",
75-
"jest": "^29.7.0",
7673
"min-qs": "^1.4.0",
7774
"min-url": "^1.5.0",
7875
"prettier": "^3.0.3",
7976
"stringlist-regexp": "^1.0.2",
77+
"tsx": "^4.20.3",
8078
"typescript": "^5.2.2"
8179
},
8280
"dependencies": {

__tests__/auth.api_key.ts renamed to test/auth.api_key.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it } from "@jest/globals"
1+
import { describe, it } from "node:test"
22
import * as assert from "node:assert"
33
import { APIKeyAuth } from "flickr-sdk"
44

__tests__/auth.oauth.ts renamed to test/auth.oauth.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { jest, describe, it } from "@jest/globals"
1+
import { describe, it, mock } from "node:test"
22
import * as assert from "node:assert"
33
import { OAuthAuth } from "flickr-sdk"
44

@@ -77,21 +77,19 @@ describe("auth/oauth", function () {
7777
"oauth token secret",
7878
)
7979

80-
jest
81-
.spyOn(
80+
mock.method(
8281
// @ts-expect-error
8382
auth.oauth,
8483
"timestamp",
84+
() => "499166400"
8585
)
86-
.mockReturnValue("499166400")
8786

88-
jest
89-
.spyOn(
87+
mock.method(
9088
// @ts-expect-error
9189
auth.oauth,
9290
"nonce",
91+
() => "p2m2bnHdXVIsQH0FUv0oN9XrJU57ak7dSSpHU36mn4k="
9392
)
94-
.mockReturnValue("p2m2bnHdXVIsQH0FUv0oN9XrJU57ak7dSSpHU36mn4k=")
9593

9694
const params = new Map()
9795

__tests__/flickr.ts renamed to test/flickr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it } from "@jest/globals"
1+
import { describe, it } from "node:test"
22
import * as assert from "node:assert"
33
import { createFlickr } from "flickr-sdk"
44

__tests__/oauth.ts renamed to test/oauth.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { jest, describe, it, beforeEach } from "@jest/globals"
1+
import { describe, it, beforeEach, mock } from "node:test"
22
import * as assert from "node:assert"
33
import { OAuth } from "flickr-sdk"
44

@@ -7,11 +7,13 @@ describe("OAuth", function () {
77

88
beforeEach(function () {
99
oauth = new OAuth("consumer key", "consumer secret")
10-
jest.spyOn(oauth, "timestamp").mockReturnValue("499166400")
10+
mock.method(oauth, "timestamp", () => "499166400")
1111

12-
jest
13-
.spyOn(oauth, "nonce")
14-
.mockReturnValue("p2m2bnHdXVIsQH0FUv0oN9XrJU57ak7dSSpHU36mn4k=")
12+
mock.method(
13+
oauth,
14+
"nonce",
15+
() => "p2m2bnHdXVIsQH0FUv0oN9XrJU57ak7dSSpHU36mn4k=",
16+
)
1517
})
1618

1719
it('requires "consumerKey" and "consumerSecret"', function () {
@@ -44,7 +46,7 @@ describe("OAuth", function () {
4446

4547
describe("#timestamp", function () {
4648
beforeEach(function () {
47-
jest.restoreAllMocks()
49+
mock.restoreAll()
4850
})
4951

5052
it("returns the current system time in seconds", function () {
@@ -54,7 +56,7 @@ describe("OAuth", function () {
5456

5557
describe("#nonce", function () {
5658
beforeEach(function () {
57-
jest.restoreAllMocks()
59+
mock.restoreAll()
5860
})
5961

6062
it("returns a string", function () {

__tests__/params.ts renamed to test/params.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it } from "@jest/globals"
1+
import { describe, it } from "node:test"
22
import * as assert from "node:assert"
33
import { GET, POST } from "flickr-sdk"
44

__tests__/parser.form.ts renamed to test/parser.form.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it } from "@jest/globals"
1+
import { describe, it } from "node:test"
22
import * as assert from "node:assert"
33
import { FormParser } from "flickr-sdk"
44

__tests__/parser.json.ts renamed to test/parser.json.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it } from "@jest/globals"
1+
import { describe, it } from "node:test"
22
import * as assert from "node:assert"
33
import { JSONParser } from "flickr-sdk"
44

__tests__/parser.xml.ts renamed to test/parser.xml.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it } from "@jest/globals"
1+
import { describe, it } from "node:test"
22
import * as assert from "node:assert"
33
import { XMLParser } from "flickr-sdk"
44

0 commit comments

Comments
 (0)