Skip to content

Commit

Permalink
Merge pull request #401 from xapijs/next
Browse files Browse the repository at this point in the history
3.0.0
  • Loading branch information
CookieCookson authored Sep 10, 2024
2 parents 2dcc399 + ada7c89 commit 7d962e2
Show file tree
Hide file tree
Showing 90 changed files with 949 additions and 386 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 3.0.0 (10 Sep 2024)

- Added `adapter` property to `XAPI` constructor params, allowing a choice between `axios` (Default), `fetch` or a custom adapter function
- Adds support for edge environments through the `fetch` adapter
- Updated `axios` to patch security vulnerability ([CVE-2024-39338](https://github.com/advisories/GHSA-8hc4-vh64-cxmj))

# 2.2.8 (31 Jul 2024)

- Updated `braces` to patch security vulnerability
Expand Down
19 changes: 19 additions & 0 deletions jest.config.edge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require("dotenv").config();

module.exports = {
preset: "ts-jest",
projects: [
{
displayName: "edge-fetch-unit",
testMatch: ["**/*.unit.test.ts"],
testEnvironment: "@edge-runtime/jest-environment",
setupFiles: ["./test/mockFetch.ts", "./test/setupFetch.ts"],
},
{
displayName: "edge-fetch-int",
testMatch: ["**/*.int.test.ts"],
testEnvironment: "@edge-runtime/jest-environment",
setupFilesAfterEnv: ["./test/setupInt.ts", "./test/setupFetch.ts"],
},
],
};
64 changes: 62 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,72 @@ module.exports = {
},
projects: [
{
displayName: "dom",
displayName: "dom-axios-unit",
testMatch: ["**/*.unit.test.ts"],
testEnvironment: "jsdom",
setupFiles: [
"./test/mockAxios.ts",
"./test/mockFetch.ts",
"./test/setupAxios.ts",
],
},
{
displayName: "node",
displayName: "dom-fetch-unit",
testMatch: ["**/*.unit.test.ts"],
testEnvironment: "jsdom",
setupFiles: [
"./test/mockAxios.ts",
"./test/mockFetch.ts",
"./test/setupFetch.ts",
],
},
{
displayName: "node-axios-unit",
testMatch: ["**/*.unit.test.ts"],
testEnvironment: "node",
setupFiles: [
"./test/mockAxios.ts",
"./test/mockFetch.ts",
"./test/setupAxios.ts",
],
},
{
displayName: "node-fetch-unit",
testMatch: ["**/*.unit.test.ts"],
testEnvironment: "node",
setupFiles: [
"./test/mockAxios.ts",
"./test/mockFetch.ts",
"./test/setupFetch.ts",
],
},
{
displayName: "dom-axios-int",
testMatch: ["**/*.int.test.ts"],
testEnvironment: "jsdom",
setupFilesAfterEnv: ["./test/setupInt.ts"],
},
{
displayName: "dom-fetch-int",
testMatch: ["**/*.int.test.ts"],
testEnvironment: "jsdom",
setupFilesAfterEnv: [
"./test/setupInt.ts",
"./test/polyfillFetch.ts",
"./test/setupFetch.ts",
],
},
{
displayName: "node-axios-int",
testMatch: ["**/*.int.test.ts"],
testEnvironment: "node",
setupFilesAfterEnv: ["./test/setupInt.ts", "./test/setupAxios.ts"],
},
{
displayName: "node-fetch-int",
testMatch: ["**/*.int.test.ts"],
testEnvironment: "node",
setupFilesAfterEnv: ["./test/setupInt.ts", "./test/setupFetch.ts"],
},
],
};
202 changes: 183 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xapi/xapi",
"version": "2.2.8",
"version": "3.0.0",
"description": "Communicate over xAPI using JavaScript.",
"main": "dist/XAPI.cjs.js",
"module": "dist/XAPI.esm.js",
Expand All @@ -16,9 +16,10 @@
"build:types": "tsc --emitDeclarationOnly",
"build": "npm run clean && npm run build:types && npm run build:js",
"format": "prettier --write '**/*.{js,jsx,json,ts,tsx}'",
"test": "jest --runInBand && npm run test:example:node:require && npm run test:example:node:import",
"test:unit": "jest --testPathPattern=.unit.test.ts",
"test:int": "jest --testPathPattern=.int.test.ts --runInBand",
"test": "jest --runInBand && npm run test:edge && npm run test:example:node:require && npm run test:example:node:import",
"test:edge": "jest --runInBand --config jest.config.edge.js",
"test:unit": "jest --selectProjects dom-axios-unit dom-fetch-unit node-axios-unit node-fetch-unit",
"test:int": "jest --selectProjects dom-axios-int dom-fetch-int node-axios-int node-fetch-int --runInBand",
"test:format": "prettier --check .",
"test:example:node:require": "node ./example/node/require.js",
"test:example:node:import": "node --experimental-modules --es-module-specifier-resolution=node ./example/node/import.mjs",
Expand All @@ -44,6 +45,7 @@
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@babel/preset-env": "^7.23.2",
"@babel/preset-typescript": "^7.23.2",
"@edge-runtime/jest-environment": "^2.3.10",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.0.1",
Expand All @@ -66,7 +68,7 @@
"rollup": "^4.3.0",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2",
"uuid": "^9.0.1"
"whatwg-fetch": "^3.6.20"
},
"dependencies": {
"axios": "^1.6.0"
Expand Down
Loading

0 comments on commit 7d962e2

Please sign in to comment.