@easyhook/core 1.0.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -1
- package/.swcrc +0 -29
- package/eslint.config.mjs +0 -25
- package/src/core/base.ts +0 -51
- package/src/index.ts +0 -5
- package/src/lib/github.spec.ts +0 -106
- package/src/types/events.ts +0 -6
- package/src/types/payload.ts +0 -5
- package/src/utils/index.ts +0 -2
- package/src/utils/intents.ts +0 -8
- package/src/utils/provider.ts +0 -6
- package/src/validator/custom.ts +0 -6
- package/src/validator/easydonate.ts +0 -11
- package/src/validator/github.ts +0 -130
- package/src/validator/index.ts +0 -3
- package/tsconfig.json +0 -13
- package/tsconfig.lib.json +0 -28
- package/tsconfig.spec.json +0 -36
- package/vite.config.ts +0 -24
- package/vitest.config.mts +0 -22
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easyhook/core",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"private": false,
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
8
12
|
"type": "module",
|
|
9
13
|
"main": "./dist/index.js",
|
|
10
14
|
"module": "./dist/index.js",
|
package/.swcrc
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"jsc": {
|
|
3
|
-
"target": "es2017",
|
|
4
|
-
"parser": {
|
|
5
|
-
"syntax": "typescript",
|
|
6
|
-
"decorators": true,
|
|
7
|
-
"dynamicImport": true
|
|
8
|
-
},
|
|
9
|
-
"transform": {
|
|
10
|
-
"decoratorMetadata": true,
|
|
11
|
-
"legacyDecorator": true
|
|
12
|
-
},
|
|
13
|
-
"keepClassNames": true,
|
|
14
|
-
"externalHelpers": true,
|
|
15
|
-
"loose": true
|
|
16
|
-
},
|
|
17
|
-
"module": {
|
|
18
|
-
"type": "es6"
|
|
19
|
-
},
|
|
20
|
-
"sourceMaps": true,
|
|
21
|
-
"exclude": [
|
|
22
|
-
"jest.config.[ct]s",
|
|
23
|
-
".*\\.spec.tsx?$",
|
|
24
|
-
".*\\.test.tsx?$",
|
|
25
|
-
"./src/jest-setup.ts$",
|
|
26
|
-
"./**/jest-setup.ts$",
|
|
27
|
-
".*.js$"
|
|
28
|
-
]
|
|
29
|
-
}
|
package/eslint.config.mjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import baseConfig from '../../eslint.config.mjs';
|
|
2
|
-
|
|
3
|
-
export default [
|
|
4
|
-
...baseConfig,
|
|
5
|
-
{
|
|
6
|
-
files: ['**/*.json'],
|
|
7
|
-
rules: {
|
|
8
|
-
'@nx/dependency-checks': [
|
|
9
|
-
'error',
|
|
10
|
-
{
|
|
11
|
-
ignoredFiles: [
|
|
12
|
-
'{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}',
|
|
13
|
-
'{projectRoot}/vite.config.{js,ts,mjs,mts}',
|
|
14
|
-
],
|
|
15
|
-
},
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
languageOptions: {
|
|
19
|
-
parser: await import('jsonc-eslint-parser'),
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
ignores: ['**/out-tsc'],
|
|
24
|
-
},
|
|
25
|
-
];
|
package/src/core/base.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
|
-
import { BaseEvents } from '../types/events.js';
|
|
3
|
-
import { HookIntentValue } from '../utils/intents.js';
|
|
4
|
-
import { HookProvider } from '../utils/provider.js';
|
|
5
|
-
import { EasydonateSchema, GithubPushSchema } from '../validator/index.js';
|
|
6
|
-
import { type } from 'arktype';
|
|
7
|
-
import { WebhookValidationError } from '../validator/custom.js';
|
|
8
|
-
|
|
9
|
-
export interface EasyhookOptions {
|
|
10
|
-
intents: HookIntentValue[];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class Easyhook extends TypedEmitter<BaseEvents> {
|
|
14
|
-
private enabledIntents: Set<string>;
|
|
15
|
-
|
|
16
|
-
constructor(options: EasyhookOptions) {
|
|
17
|
-
super();
|
|
18
|
-
this.enabledIntents = new Set(options.intents);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public isWebhook(provider: HookProvider, body: unknown) {
|
|
22
|
-
if (!this.enabledIntents.has(provider)) {
|
|
23
|
-
throw new Error(`Intent for ${provider} is not enabled`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
switch (provider) {
|
|
27
|
-
case HookProvider.EasyDonate: {
|
|
28
|
-
const input = EasydonateSchema(body);
|
|
29
|
-
|
|
30
|
-
if (input instanceof type.errors) {
|
|
31
|
-
throw new WebhookValidationError(provider, input.summary);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
this.emit('easydonate', input);
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
case HookProvider.Github: {
|
|
38
|
-
const input = GithubPushSchema(body);
|
|
39
|
-
|
|
40
|
-
if (input instanceof type.errors) {
|
|
41
|
-
throw new WebhookValidationError(provider, input.summary);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
this.emit('github', input);
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
default:
|
|
48
|
-
throw new Error(`Unhandled provider: ${provider}`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
package/src/index.ts
DELETED
package/src/lib/github.spec.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
-
import { Easyhook } from '../core/base.js';
|
|
3
|
-
import { HookProvider } from '../utils/provider.js';
|
|
4
|
-
|
|
5
|
-
describe('Github Webhook Provider', () => {
|
|
6
|
-
it('should handle github push event and emit "github"', () => {
|
|
7
|
-
const easyhook = new Easyhook({
|
|
8
|
-
intents: ['github'],
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const spy = vi.fn();
|
|
12
|
-
easyhook.on('github', spy);
|
|
13
|
-
|
|
14
|
-
const payload = {
|
|
15
|
-
ref: 'refs/heads/main',
|
|
16
|
-
before: 'before-hash',
|
|
17
|
-
after: 'after-hash',
|
|
18
|
-
repository: {
|
|
19
|
-
id: 123456,
|
|
20
|
-
name: 'test-repo',
|
|
21
|
-
full_name: 'owner/test-repo',
|
|
22
|
-
private: false,
|
|
23
|
-
owner: {
|
|
24
|
-
name: 'owner',
|
|
25
|
-
email: 'owner@example.com',
|
|
26
|
-
login: 'owner',
|
|
27
|
-
id: 1,
|
|
28
|
-
avatar_url: 'https://avatar.url',
|
|
29
|
-
url: 'https://api.github.com/users/owner',
|
|
30
|
-
},
|
|
31
|
-
html_url: 'https://github.com/owner/test-repo',
|
|
32
|
-
description: 'Test Repository',
|
|
33
|
-
fork: false,
|
|
34
|
-
url: 'https://api.github.com/repos/owner/test-repo',
|
|
35
|
-
created_at: 1234567890,
|
|
36
|
-
updated_at: '2023-01-01T00:00:00Z',
|
|
37
|
-
pushed_at: 1234567890,
|
|
38
|
-
homepage: null,
|
|
39
|
-
size: 100,
|
|
40
|
-
stargazers_count: 10,
|
|
41
|
-
watchers_count: 10,
|
|
42
|
-
language: 'TypeScript',
|
|
43
|
-
has_issues: true,
|
|
44
|
-
has_projects: true,
|
|
45
|
-
has_downloads: true,
|
|
46
|
-
has_wiki: true,
|
|
47
|
-
has_pages: false,
|
|
48
|
-
forks_count: 0,
|
|
49
|
-
mirror_url: null,
|
|
50
|
-
open_issues_count: 0,
|
|
51
|
-
forks: 0,
|
|
52
|
-
open_issues: 0,
|
|
53
|
-
watchers: 10,
|
|
54
|
-
default_branch: 'main',
|
|
55
|
-
},
|
|
56
|
-
pusher: {
|
|
57
|
-
name: 'pusher',
|
|
58
|
-
email: 'pusher@example.com',
|
|
59
|
-
},
|
|
60
|
-
sender: {
|
|
61
|
-
login: 'sender',
|
|
62
|
-
id: 2,
|
|
63
|
-
avatar_url: 'https://avatar.url',
|
|
64
|
-
url: 'https://api.github.com/users/sender',
|
|
65
|
-
},
|
|
66
|
-
commits: [
|
|
67
|
-
{
|
|
68
|
-
id: 'commit-hash',
|
|
69
|
-
tree_id: 'tree-hash',
|
|
70
|
-
distinct: true,
|
|
71
|
-
message: 'feat: add github webhook',
|
|
72
|
-
timestamp: '2023-01-01T00:00:00Z',
|
|
73
|
-
url: 'https://github.com/owner/test-repo/commit/commit-hash',
|
|
74
|
-
author: {
|
|
75
|
-
name: 'author',
|
|
76
|
-
email: 'author@example.com',
|
|
77
|
-
username: 'author',
|
|
78
|
-
},
|
|
79
|
-
committer: {
|
|
80
|
-
name: 'committer',
|
|
81
|
-
email: 'committer@example.com',
|
|
82
|
-
username: 'committer',
|
|
83
|
-
},
|
|
84
|
-
added: [],
|
|
85
|
-
removed: [],
|
|
86
|
-
modified: ['packages/core/src/index.ts'],
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
easyhook.isWebhook(HookProvider.Github, payload);
|
|
92
|
-
|
|
93
|
-
expect(spy).toHaveBeenCalledTimes(1);
|
|
94
|
-
expect(spy).toHaveBeenCalledWith(payload);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('should throw error if provider is not enabled', () => {
|
|
98
|
-
const easyhook = new Easyhook({
|
|
99
|
-
intents: ['easydonate'], // Github not enabled
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
expect(() => {
|
|
103
|
-
easyhook.isWebhook(HookProvider.Github, {});
|
|
104
|
-
}).toThrow('Intent for github is not enabled');
|
|
105
|
-
});
|
|
106
|
-
});
|
package/src/types/events.ts
DELETED
package/src/types/payload.ts
DELETED
package/src/utils/index.ts
DELETED
package/src/utils/intents.ts
DELETED
package/src/utils/provider.ts
DELETED
package/src/validator/custom.ts
DELETED
package/src/validator/github.ts
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { type } from 'arktype';
|
|
2
|
-
|
|
3
|
-
export const GithubPushSchema = type({
|
|
4
|
-
ref: 'string',
|
|
5
|
-
before: 'string',
|
|
6
|
-
after: 'string',
|
|
7
|
-
repository: {
|
|
8
|
-
id: 'number',
|
|
9
|
-
name: 'string',
|
|
10
|
-
full_name: 'string',
|
|
11
|
-
private: 'boolean',
|
|
12
|
-
owner: {
|
|
13
|
-
name: 'string',
|
|
14
|
-
email: 'string?',
|
|
15
|
-
login: 'string',
|
|
16
|
-
id: 'number',
|
|
17
|
-
avatar_url: 'string',
|
|
18
|
-
url: 'string',
|
|
19
|
-
},
|
|
20
|
-
html_url: 'string',
|
|
21
|
-
description: 'string|null',
|
|
22
|
-
fork: 'boolean',
|
|
23
|
-
url: 'string',
|
|
24
|
-
created_at: 'number|string',
|
|
25
|
-
updated_at: 'string',
|
|
26
|
-
pushed_at: 'number|string',
|
|
27
|
-
homepage: 'string|null',
|
|
28
|
-
size: 'number',
|
|
29
|
-
stargazers_count: 'number',
|
|
30
|
-
watchers_count: 'number',
|
|
31
|
-
language: 'string|null',
|
|
32
|
-
has_issues: 'boolean',
|
|
33
|
-
has_projects: 'boolean',
|
|
34
|
-
has_downloads: 'boolean',
|
|
35
|
-
has_wiki: 'boolean',
|
|
36
|
-
has_pages: 'boolean',
|
|
37
|
-
forks_count: 'number',
|
|
38
|
-
mirror_url: 'string|null',
|
|
39
|
-
open_issues_count: 'number',
|
|
40
|
-
forks: 'number',
|
|
41
|
-
open_issues: 'number',
|
|
42
|
-
watchers: 'number',
|
|
43
|
-
default_branch: 'string',
|
|
44
|
-
},
|
|
45
|
-
pusher: {
|
|
46
|
-
name: 'string',
|
|
47
|
-
email: 'string?',
|
|
48
|
-
},
|
|
49
|
-
sender: {
|
|
50
|
-
login: 'string',
|
|
51
|
-
id: 'number',
|
|
52
|
-
avatar_url: 'string',
|
|
53
|
-
url: 'string',
|
|
54
|
-
},
|
|
55
|
-
commits: type([
|
|
56
|
-
{
|
|
57
|
-
id: 'string',
|
|
58
|
-
tree_id: 'string',
|
|
59
|
-
distinct: 'boolean',
|
|
60
|
-
message: 'string',
|
|
61
|
-
timestamp: 'string',
|
|
62
|
-
url: 'string',
|
|
63
|
-
author: {
|
|
64
|
-
name: 'string',
|
|
65
|
-
email: 'string',
|
|
66
|
-
username: 'string?',
|
|
67
|
-
},
|
|
68
|
-
committer: {
|
|
69
|
-
name: 'string',
|
|
70
|
-
email: 'string',
|
|
71
|
-
username: 'string?',
|
|
72
|
-
},
|
|
73
|
-
added: 'string[]',
|
|
74
|
-
removed: 'string[]',
|
|
75
|
-
modified: 'string[]',
|
|
76
|
-
},
|
|
77
|
-
'[]',
|
|
78
|
-
]),
|
|
79
|
-
'head_commit?': {
|
|
80
|
-
id: 'string',
|
|
81
|
-
tree_id: 'string',
|
|
82
|
-
distinct: 'boolean',
|
|
83
|
-
message: 'string',
|
|
84
|
-
timestamp: 'string',
|
|
85
|
-
url: 'string',
|
|
86
|
-
author: {
|
|
87
|
-
name: 'string',
|
|
88
|
-
email: 'string',
|
|
89
|
-
username: 'string?',
|
|
90
|
-
},
|
|
91
|
-
committer: {
|
|
92
|
-
name: 'string',
|
|
93
|
-
email: 'string',
|
|
94
|
-
username: 'string?',
|
|
95
|
-
},
|
|
96
|
-
added: 'string[]',
|
|
97
|
-
removed: 'string[]',
|
|
98
|
-
modified: 'string[]',
|
|
99
|
-
} as const as any, // ArkType doesn't support complex union literals in object keys easily without separate definition or helper, but wait. The user suggested: "'head_commit?': '{ ... } | null'".
|
|
100
|
-
// Let's use the object definition form but wrapped in a union if possible or just use '...|null' string def if it was a string.
|
|
101
|
-
// Since it's an object definition, I can't just make the key a string like 'head_commit?': '... | null'.
|
|
102
|
-
// I need to check how arktype handles optional nullable objects.
|
|
103
|
-
// Actually, arktype `type({...})` takes an object.
|
|
104
|
-
// If I want it to be nullable, I might need to define the object type separately.
|
|
105
|
-
// OR, I can use the string format for the whole property if I could serialize the object schema.
|
|
106
|
-
// BUT, looking at the user request: "change the field type to the object OR null, e.g., "'head_commit?': '{ ... } | null'""
|
|
107
|
-
// This implies ArkType supports defining the value as a type definition.
|
|
108
|
-
// Wait, the existing code uses object literal syntax for `head_commit`.
|
|
109
|
-
// I will try to use the `type` wrapper for the value or just union it if ArkType allows `type({ key: { ... } | null })` (syntax error in TS).
|
|
110
|
-
// The user suggestion: `head_commit?: ... | null`.
|
|
111
|
-
// Let's try to define the inner object schema and union it with null.
|
|
112
|
-
// Actually, simplest is to use `type` for the inner object?
|
|
113
|
-
// Let's look at `repository` definition in lines 7-44. It is nested object.
|
|
114
|
-
// If I want `head_commit` to be nullable, I should probably do:
|
|
115
|
-
// 'head_commit?': type({ ... }).or('null')
|
|
116
|
-
// Let's see if I can do that.
|
|
117
|
-
// User said: "allow null using arktype's union syntax ... e.g., "'head_commit?': '{ ... } | null'""
|
|
118
|
-
// Maybe they meant replacing the object literal with a string representation if arktype supports it?
|
|
119
|
-
// But `head_commit` has many fields.
|
|
120
|
-
// I will define the `HeadCommitSchema` string constant or object and use it? No, keep it inline if possible.
|
|
121
|
-
// PROPOSED FIX:
|
|
122
|
-
// 'head_commit?': type({ ... }).or('null') if that works.
|
|
123
|
-
// OR, maybe stricter: validation might fail if I just hack it.
|
|
124
|
-
// Let's assume `type({ ... })` returns a Type.
|
|
125
|
-
// So: `'head_commit?': type({ ... }).or('null')` should be valid JS/TS if `type` comes from `arktype`.
|
|
126
|
-
// However, `head_commit?` is a key in the object passed to outer `type()`.
|
|
127
|
-
// So the value must be a definition.
|
|
128
|
-
// `type({ ... })` is a Type, which is a valid definition.
|
|
129
|
-
// So I will convert the object literal to `type({...}).or('null')`.
|
|
130
|
-
});
|
package/src/validator/index.ts
DELETED
package/tsconfig.json
DELETED
package/tsconfig.lib.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"baseUrl": ".",
|
|
5
|
-
"rootDir": "src",
|
|
6
|
-
"outDir": "dist",
|
|
7
|
-
"tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
|
|
8
|
-
"emitDeclarationOnly": true,
|
|
9
|
-
"forceConsistentCasingInFileNames": true,
|
|
10
|
-
"types": ["node"]
|
|
11
|
-
},
|
|
12
|
-
"include": ["src/**/*.ts"],
|
|
13
|
-
"references": [],
|
|
14
|
-
"exclude": [
|
|
15
|
-
"vite.config.ts",
|
|
16
|
-
"vite.config.mts",
|
|
17
|
-
"vitest.config.ts",
|
|
18
|
-
"vitest.config.mts",
|
|
19
|
-
"src/**/*.test.ts",
|
|
20
|
-
"src/**/*.spec.ts",
|
|
21
|
-
"src/**/*.test.tsx",
|
|
22
|
-
"src/**/*.spec.tsx",
|
|
23
|
-
"src/**/*.test.js",
|
|
24
|
-
"src/**/*.spec.js",
|
|
25
|
-
"src/**/*.test.jsx",
|
|
26
|
-
"src/**/*.spec.jsx"
|
|
27
|
-
]
|
|
28
|
-
}
|
package/tsconfig.spec.json
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "./out-tsc/vitest",
|
|
5
|
-
"types": [
|
|
6
|
-
"vitest/globals",
|
|
7
|
-
"vitest/importMeta",
|
|
8
|
-
"vite/client",
|
|
9
|
-
"node",
|
|
10
|
-
"vitest"
|
|
11
|
-
],
|
|
12
|
-
"forceConsistentCasingInFileNames": true
|
|
13
|
-
},
|
|
14
|
-
"include": [
|
|
15
|
-
"vite.config.ts",
|
|
16
|
-
"vite.config.mts",
|
|
17
|
-
"vitest.config.ts",
|
|
18
|
-
"vitest.config.mts",
|
|
19
|
-
"src/**/*.test.ts",
|
|
20
|
-
"src/**/*.spec.ts",
|
|
21
|
-
"src/**/*.test.tsx",
|
|
22
|
-
"src/**/*.spec.tsx",
|
|
23
|
-
"src/**/*.test.js",
|
|
24
|
-
"src/**/*.spec.js",
|
|
25
|
-
"src/**/*.test.jsx",
|
|
26
|
-
"src/**/*.spec.jsx",
|
|
27
|
-
"src/**/*.d.ts",
|
|
28
|
-
"src/types/payload.ts",
|
|
29
|
-
"src/types/events.ts"
|
|
30
|
-
],
|
|
31
|
-
"references": [
|
|
32
|
-
{
|
|
33
|
-
"path": "./tsconfig.lib.json"
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
}
|
package/vite.config.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/// <reference types='vitest' />
|
|
2
|
-
import { defineConfig } from 'vite';
|
|
3
|
-
|
|
4
|
-
export default defineConfig(() => ({
|
|
5
|
-
root: import.meta.dirname,
|
|
6
|
-
cacheDir: '../../node_modules/.vite/packages/core',
|
|
7
|
-
plugins: [],
|
|
8
|
-
// Uncomment this if you are using workers.
|
|
9
|
-
// worker: {
|
|
10
|
-
// plugins: [],
|
|
11
|
-
// },
|
|
12
|
-
test: {
|
|
13
|
-
name: '@easyhook/core',
|
|
14
|
-
watch: false,
|
|
15
|
-
globals: true,
|
|
16
|
-
environment: 'node',
|
|
17
|
-
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
18
|
-
reporters: ['default'],
|
|
19
|
-
coverage: {
|
|
20
|
-
reportsDirectory: './test-output/vitest/coverage',
|
|
21
|
-
provider: 'v8' as const,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
}));
|
package/vitest.config.mts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vitest/config';
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
3
|
-
import { dirname } from 'path';
|
|
4
|
-
|
|
5
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
|
|
7
|
-
export default defineConfig(() => ({
|
|
8
|
-
root: __dirname,
|
|
9
|
-
cacheDir: '../../node_modules/.vite/packages/core',
|
|
10
|
-
test: {
|
|
11
|
-
name: '@easyhook/core',
|
|
12
|
-
watch: false,
|
|
13
|
-
globals: true,
|
|
14
|
-
environment: 'node',
|
|
15
|
-
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
16
|
-
reporters: ['default'],
|
|
17
|
-
coverage: {
|
|
18
|
-
reportsDirectory: './test-output/vitest/coverage',
|
|
19
|
-
provider: 'v8' as const,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
}));
|