Skip to content

Commit

Permalink
fix: switch to npm for package management
Browse files Browse the repository at this point in the history
  • Loading branch information
jenspots committed Mar 12, 2024
1 parent 3ee376e commit 12d5d3a
Show file tree
Hide file tree
Showing 10 changed files with 6,731 additions and 17 deletions.
Binary file removed bun.lockb
Binary file not shown.
17 changes: 17 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { Config } from "@jest/types";
import dotenv from "dotenv";

dotenv.config();

const config: Config.InitialOptions = {
preset: "ts-jest",
testEnvironment: "node",
roots: ["<rootDir>"],
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
testMatch: ["<rootDir>/tests/**/*.test.ts"],
transform: {
"^.+\\.tsx?$": "ts-jest",
},
};

export default config;
6,699 changes: 6,699 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"build": "tsc",
"test": "bun test",
"test": "jest",
"pretest": "bun run build"
},
"files": [
Expand All @@ -25,6 +25,7 @@
"@ajuvercr/js-runner": "^0.1.14",
"@jest/globals": "^29.7.0",
"@types/bun": "^1.0.5",
"@types/jest": "^29.5.12",
"@types/jsdom": "^21.1.6",
"@types/supertest": "^6.0.2",
"@typescript-eslint/eslint-plugin": "^7.0.1",
Expand All @@ -34,7 +35,8 @@
"jsdom": "^24.0.0",
"oauth2-mock-server": "^7.1.1",
"prettier": "3.2.5",
"supertest": "^6.3.4"
"supertest": "^6.3.4",
"ts-jest": "^29.1.2"
},
"peerDependencies": {
"typescript": "^5.0.0"
Expand All @@ -43,6 +45,9 @@
"@node-oauth/express-oauth-server": "^4.0.0",
"@node-oauth/oauth2-server": "^5.1.0",
"@treecg/connector-types": "^1.2.1",
"cron": "^3.1.6"
"cron": "^3.1.6",
"dotenv": "^16.4.5",
"jest": "^29.7.0",
"ts-node": "^10.9.2"
}
}
2 changes: 1 addition & 1 deletion tests/auth/oauth/password.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, test } from "bun:test";
import { describe, test } from "@jest/globals";

describe.skip("OAuth2.0 Password Grant", () => {
test("successful", () => {
Expand Down
7 changes: 0 additions & 7 deletions tests/processors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ describe("processor", () => {

// No other options are given.
expect(options).toBeUndefined();

await checkProc(env.file, env.func);
});
});

Expand All @@ -68,8 +66,3 @@ function testWriter(arg: any) {
expect(arg.channel.id).toBeDefined();
expect(arg.ty).toBeDefined();
}

async function checkProc(location: string, func: string) {
const mod = await import("file://" + location);
expect(mod[func]).toBeDefined();
}
2 changes: 1 addition & 1 deletion tests/util/cron.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("cron", () => {
// After five seconds, the function should be called five times.
await new Promise((res) => setTimeout(res, 5_000));
expect(mock).toHaveBeenCalledTimes(5);
});
}, 10_000);

test("invalid cron expression", () => {
expect(cronify(async () => {}, "")()).rejects.toThrow(
Expand Down
6 changes: 3 additions & 3 deletions tests/util/headers.test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { describe, expect, test } from "bun:test";
import { describe, expect, test } from "@jest/globals";
import { parseHeaders } from "../../src/util/headers";
import { HttpUtilsError } from "../../src/error";

describe("parseHeaders", () => {
test("empty", () => {
const headers: string[] = [];
const obj = parseHeaders(headers);
expect(obj.count).toBe(0);
expect(Array.from(obj.keys()).length).toBe(0);
});

test("valid", () => {
const headers = ["a: b", "c: d"];
const obj = parseHeaders(headers);
expect(obj.get("a")).toBe("b");
expect(obj.get("c")).toBe("d");
expect(obj.count).toBe(2);
expect(Array.from(obj.keys()).length).toBe(2);
});

test("invalid", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/util/status.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect, test } from "bun:test";
import { describe, expect, test } from "@jest/globals";
import { statusCodeAccepted } from "../../src/util/status";
import { HttpUtilsError } from "../../src/error";

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"allowSyntheticDefaultImports": true,
"incremental": true,
"esModuleInterop": true,
"types": ["bun-types"]
"removeComments": true
},
"ts-node": {
"esm": true,
Expand Down

0 comments on commit 12d5d3a

Please sign in to comment.