Skip to content

Commit a5b13d2

Browse files
committed
Also explicitly allow referencing the name property.
1 parent ad5a86c commit a5b13d2

11 files changed

Lines changed: 2204 additions & 1357 deletions

File tree

.eslintrc

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

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Set up Node.js
2020
uses: actions/setup-node@v4
2121
with:
22-
node-version: 18
22+
node-version: 20
2323
registry-url: 'https://registry.npmjs.org'
2424

2525
- name: Install packages

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18
1+
20

.vscode/launch.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "node",
6+
"request": "launch",
7+
"name": "Debug Vitest Tests",
8+
"autoAttachChildProcesses": true,
9+
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
10+
"program": "${workspaceFolder}/node_modules/vitest/vitest.mjs",
11+
"args": ["run", "--reporter=verbose"],
12+
"smartStep": true
13+
},
14+
{
15+
"type": "node",
16+
"request": "launch",
17+
"name": "Debug Current Test File",
18+
"autoAttachChildProcesses": true,
19+
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
20+
"program": "${workspaceFolder}/node_modules/vitest/vitest.mjs",
21+
"args": ["run", "--reporter=verbose", "${relativeFile}"],
22+
"smartStep": true
23+
}
24+
]
25+
}

eslint.config.mjs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import authressConfig from '@authress/eslint-config';
2+
3+
export default [
4+
{ ignores: ['node_modules/'] },
5+
...authressConfig,
6+
{
7+
files: ['index.js'],
8+
rules: {
9+
'no-extend-native': 'off'
10+
}
11+
},
12+
{
13+
files: ['tests/**/*.js'],
14+
languageOptions: {
15+
globals: {
16+
describe: 'readonly',
17+
it: 'readonly',
18+
expect: 'readonly',
19+
beforeEach: 'readonly',
20+
afterEach: 'readonly',
21+
beforeAll: 'readonly',
22+
afterAll: 'readonly',
23+
ApplicationError: 'readonly'
24+
}
25+
}
26+
}
27+
];

index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export default class ApplicationError extends Error {
2+
name: string;
23
code: string;
34
stack: string;
4-
message: unknown;
5+
message: string | Record<string, unknown>;
56
constructor(message: unknown, code?: string);
67
}

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class ApplicationErrorExtension extends Error {
3333

3434
this.message = message;
3535
this.code = code;
36+
this.name = code;
3637
}
3738

3839
get [Symbol.toStringTag]() {
@@ -61,17 +62,18 @@ if (typeof global !== 'undefined') {
6162
module.exports = ApplicationError;
6263
module.exports.ApplicationError = ApplicationError;
6364

64-
/* eslint-disable no-extend-native */
6565
Error.create = function(errorObject, code) {
6666
if (!(this instanceof Error)) {
6767
const error = new Error().create(errorObject, code);
6868
if (typeof Error.captureStackTrace !== 'undefined') {
6969
Error.captureStackTrace(error, Error.create);
7070
}
71+
error.name = error.name || error.code;
7172
return error;
7273
}
7374
this.message = errorObject;
7475
this.code = code || typeof errorObject === 'string' && errorObject || typeof errorObject === 'object' && errorObject.code || null;
76+
this.name = code;
7577
return this;
7678
};
7779
Error.prototype.create = Error.create;

package.json

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,26 @@
99
"index.d.ts"
1010
],
1111
"scripts": {
12-
"lint": "eslint --ext .js tests index.js",
13-
"test": "mocha tests/**/*.js -R spec"
12+
"lint": "eslint tests index.js",
13+
"test": "vitest run"
1414
},
1515
"dependencies": {
1616
"json-stringify-safe": "^5.0.1"
1717
},
1818
"devDependencies": {
19-
"@typescript-eslint/eslint-plugin": "^3.1.0",
20-
"@typescript-eslint/parser": "^3.1.0",
21-
"chai": "^3.5.0",
2219
"ci-build-tools": "^1.0.13",
2320
"commander": "^2.15.1",
24-
"eslint": "^7.12.1",
25-
"eslint-config-cimpress-atsquad": "^1.0.67",
26-
"eslint-plugin-import": "^2.22.1",
27-
"eslint-plugin-mocha": "^7.0.1",
28-
"eslint-plugin-node": "^11.1.0",
29-
"eslint-plugin-promise": "^6.1.1",
21+
"@authress/eslint-config": "^2.0.14",
3022
"fs-extra": "^9.0.1",
3123
"glob": "^5.0.15",
32-
"mocha": "^11.7.1",
3324
"sinon": "^1.17.3",
34-
"typescript": "^3.9.5"
25+
"typescript": "^3.9.5",
26+
"vitest": "^3.0.0",
27+
"eslint": "^9.19.0",
28+
"eslint-plugin-import": "^2.31.0",
29+
"@eslint/eslintrc": "^3.2.0",
30+
"@typescript-eslint/eslint-plugin": "^8.54.0",
31+
"@typescript-eslint/parser": "^8.56.0"
3532
},
3633
"repository": {
3734
"type": "git",
@@ -44,7 +41,7 @@
4441
"error object"
4542
],
4643
"engines": {
47-
"node": ">=18"
44+
"node": ">=20"
4845
},
4946
"author": "Rhosys Developers <developers@rhosys.ch> (http://rhosys.ch)",
5047
"license": "GPL-3.0",

0 commit comments

Comments
 (0)