-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathbuildOptions.test-d.ts
More file actions
130 lines (120 loc) · 4.01 KB
/
buildOptions.test-d.ts
File metadata and controls
130 lines (120 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import { describe, expectTypeOf, it } from 'vitest';
import type { SentryNuxtModuleOptions } from '../../src/common/types';
describe('Sentry Nuxt build-time options type', () => {
it('includes all options based on type BuildTimeOptionsBase', () => {
const completeOptions: SentryNuxtModuleOptions = {
// --- BuildTimeOptionsBase options ---
org: 'test-org',
project: 'test-project',
authToken: 'test-auth-token',
sentryUrl: 'https://sentry.io',
headers: { Authorization: ' Bearer test-auth-token' },
telemetry: true,
silent: false,
// eslint-disable-next-line no-console
errorHandler: (err: Error) => console.warn(err),
debug: false,
sourcemaps: {
disable: false,
assets: ['./dist/**/*'],
ignore: ['./dist/*.map'],
filesToDeleteAfterUpload: ['./dist/*.map'],
},
release: {
name: 'test-release-1.0.0',
create: true,
finalize: true,
dist: 'test-dist',
vcsRemote: 'origin',
setCommits: {
auto: false,
repo: 'test/repo',
commit: 'abc123',
previousCommit: 'def456',
ignoreMissing: false,
ignoreEmpty: false,
},
deploy: {
env: 'production',
started: 1234567890,
finished: 1234567900,
time: 10,
name: 'deployment-name',
url: 'https://example.com',
},
},
bundleSizeOptimizations: {
excludeDebugStatements: true,
excludeTracing: false,
excludeReplayShadowDom: true,
excludeReplayIframe: true,
excludeReplayWorker: true,
},
// --- SentryNuxtModuleOptions specific options ---
enabled: true,
autoInjectServerSentry: 'experimental_dynamic-import',
configDir: '~/custom-config',
experimental_entrypointWrappedFunctions: ['default', 'handler', 'server', 'customExport'],
unstable_sentryBundlerPluginOptions: {
// Rollup plugin options
bundleSizeOptimizations: {
excludeDebugStatements: true,
},
// Vite plugin options
sourcemaps: {
assets: './dist/**/*',
},
},
};
expectTypeOf(completeOptions).toEqualTypeOf<SentryNuxtModuleOptions>();
});
it('includes all deprecated options', () => {
const completeOptions: SentryNuxtModuleOptions = {
// SentryNuxtModuleOptions specific options
enabled: true,
debug: true,
autoInjectServerSentry: 'experimental_dynamic-import', // No need for 'as const' with type assertion
experimental_entrypointWrappedFunctions: ['default', 'handler', 'server', 'customExport'],
unstable_sentryBundlerPluginOptions: {
// Rollup plugin options
bundleSizeOptimizations: {
excludeDebugStatements: true,
},
// Vite plugin options
sourcemaps: {
assets: './dist/**/*',
},
},
// Deprecated sourceMapsUploadOptions
sourceMapsUploadOptions: {
silent: false,
// eslint-disable-next-line no-console
errorHandler: (err: Error) => console.warn(err),
release: {
name: 'deprecated-release',
},
enabled: true,
authToken: 'deprecated-token',
org: 'deprecated-org',
url: 'https://deprecated.sentry.io',
project: 'deprecated-project',
telemetry: false,
sourcemaps: {
assets: './build/**/*',
ignore: ['./build/*.spec.js'],
filesToDeleteAfterUpload: ['./build/*.map'],
},
},
};
expectTypeOf(completeOptions).toEqualTypeOf<SentryNuxtModuleOptions>();
});
it('allows partial configuration', () => {
const minimalOptions: SentryNuxtModuleOptions = { enabled: true };
expectTypeOf(minimalOptions).toEqualTypeOf<SentryNuxtModuleOptions>();
const partialOptions: SentryNuxtModuleOptions = {
enabled: true,
debug: false,
};
expectTypeOf(partialOptions).toEqualTypeOf<SentryNuxtModuleOptions>();
});
});