vitest 0.24.5 → 0.25.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/LICENSE.md +286 -57
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +17 -10
- package/dist/{chunk-api-setup.629f8133.js → chunk-api-setup.a13c5f9d.js} +38 -19
- package/dist/{chunk-install-pkg.22707ee4.js → chunk-install-pkg.55bfe508.js} +4 -5
- package/dist/{chunk-integrations-coverage.cca09977.js → chunk-integrations-coverage.befed097.js} +57 -1
- package/dist/chunk-integrations-globals.391b3839.js +25 -0
- package/dist/{chunk-node-git.82174cfe.js → chunk-node-git.af5c9d73.js} +5 -6
- package/dist/{chunk-runtime-chain.37ec5d73.js → chunk-runtime-chain.3b531731.js} +27 -23
- package/dist/{chunk-runtime-error.17751c39.js → chunk-runtime-error.3cc15c6f.js} +9 -2
- package/dist/{chunk-runtime-mocker.41b92ec9.js → chunk-runtime-mocker.a5d87666.js} +4 -4
- package/dist/{chunk-runtime-rpc.b418c0ab.js → chunk-runtime-rpc.4a2d45ab.js} +2 -2
- package/dist/chunk-runtime-setup.f644ac4c.js +1350 -0
- package/dist/{chunk-runtime-hooks.d748b085.js → chunk-runtime-test-state.31ce8643.js} +106 -6
- package/dist/{chunk-mock-date.030959d3.js → chunk-typecheck-constants.410fa7b2.js} +23 -4
- package/dist/{chunk-utils-env.b1281522.js → chunk-utils-env.7fe285cc.js} +2 -0
- package/dist/chunk-utils-source-map.1a66263d.js +90 -0
- package/dist/{chunk-utils-timers.8fca243e.js → chunk-utils-timers.d1fcc6bb.js} +86 -79
- package/dist/{chunk-vite-node-client.3868b3ba.js → chunk-vite-node-client.13ea0a59.js} +25 -5
- package/dist/{chunk-vite-node-externalize.d9033432.js → chunk-vite-node-externalize.01d0d22c.js} +821 -92
- package/dist/chunk-vite-node-utils.b89230f3.js +1400 -0
- package/dist/cli-wrapper.js +5 -6
- package/dist/cli.js +27 -13
- package/dist/config.cjs +6 -1
- package/dist/config.d.ts +6 -1
- package/dist/config.js +6 -1
- package/dist/entry.js +11 -10
- package/dist/environments.d.ts +1 -1
- package/dist/index-b68b3c09.d.ts +256 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +13 -7
- package/dist/loader.js +4 -3
- package/dist/node.d.ts +2 -2
- package/dist/node.js +18 -11
- package/dist/suite.js +6 -6
- package/dist/{global-58e8e951.d.ts → types-b3ff5eea.d.ts} +215 -18
- package/dist/{vendor-index.cc8d244b.js → vendor-index.16d769d7.js} +1 -2
- package/dist/{vendor-index.12d51d29.js → vendor-index.22806ffb.js} +279 -7
- package/dist/{vendor-index.9c919048.js → vendor-index.808a85a6.js} +0 -0
- package/dist/worker.js +9 -8
- package/globals.d.ts +2 -0
- package/package.json +13 -9
- package/dist/chunk-integrations-globals.32ef80c3.js +0 -25
- package/dist/chunk-runtime-setup.ab6b6274.js +0 -676
- package/dist/chunk-utils-source-map.663e2952.js +0 -3429
- package/dist/chunk-vite-node-utils.2144000e.js +0 -6946
- package/dist/index-220c1d70.d.ts +0 -117
- package/dist/vendor-index.1a291e86.js +0 -275
package/dist/index-220c1d70.d.ts
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { SpyImpl } from 'tinyspy';
|
|
2
|
-
import { m as SuiteAPI, l as TestAPI, al as BenchmarkAPI, o as SuiteHooks, H as HookListener, s as TestContext, S as Suite, n as HookCleanupCallback, h as Test } from './global-58e8e951.js';
|
|
3
|
-
|
|
4
|
-
interface MockResultReturn<T> {
|
|
5
|
-
type: 'return';
|
|
6
|
-
value: T;
|
|
7
|
-
}
|
|
8
|
-
interface MockResultIncomplete {
|
|
9
|
-
type: 'incomplete';
|
|
10
|
-
value: undefined;
|
|
11
|
-
}
|
|
12
|
-
interface MockResultThrow {
|
|
13
|
-
type: 'throw';
|
|
14
|
-
value: any;
|
|
15
|
-
}
|
|
16
|
-
declare type MockResult<T> = MockResultReturn<T> | MockResultThrow | MockResultIncomplete;
|
|
17
|
-
interface MockContext<TArgs, TReturns> {
|
|
18
|
-
calls: TArgs[];
|
|
19
|
-
instances: TReturns[];
|
|
20
|
-
invocationCallOrder: number[];
|
|
21
|
-
results: MockResult<TReturns>[];
|
|
22
|
-
lastCall: TArgs | undefined;
|
|
23
|
-
}
|
|
24
|
-
declare type Procedure = (...args: any[]) => any;
|
|
25
|
-
declare type Methods<T> = {
|
|
26
|
-
[K in keyof T]: T[K] extends Procedure ? K : never;
|
|
27
|
-
}[keyof T] & (string | symbol);
|
|
28
|
-
declare type Properties<T> = {
|
|
29
|
-
[K in keyof T]: T[K] extends Procedure ? never : K;
|
|
30
|
-
}[keyof T] & (string | symbol);
|
|
31
|
-
declare type Classes<T> = {
|
|
32
|
-
[K in keyof T]: T[K] extends new (...args: any[]) => any ? K : never;
|
|
33
|
-
}[keyof T] & (string | symbol);
|
|
34
|
-
interface SpyInstance<TArgs extends any[] = any[], TReturns = any> {
|
|
35
|
-
getMockName(): string;
|
|
36
|
-
mockName(n: string): this;
|
|
37
|
-
mock: MockContext<TArgs, TReturns>;
|
|
38
|
-
mockClear(): this;
|
|
39
|
-
mockReset(): this;
|
|
40
|
-
mockRestore(): void;
|
|
41
|
-
getMockImplementation(): ((...args: TArgs) => TReturns) | undefined;
|
|
42
|
-
mockImplementation(fn: ((...args: TArgs) => TReturns) | (() => Promise<TReturns>)): this;
|
|
43
|
-
mockImplementationOnce(fn: ((...args: TArgs) => TReturns) | (() => Promise<TReturns>)): this;
|
|
44
|
-
mockReturnThis(): this;
|
|
45
|
-
mockReturnValue(obj: TReturns): this;
|
|
46
|
-
mockReturnValueOnce(obj: TReturns): this;
|
|
47
|
-
mockResolvedValue(obj: Awaited<TReturns>): this;
|
|
48
|
-
mockResolvedValueOnce(obj: Awaited<TReturns>): this;
|
|
49
|
-
mockRejectedValue(obj: any): this;
|
|
50
|
-
mockRejectedValueOnce(obj: any): this;
|
|
51
|
-
}
|
|
52
|
-
interface MockInstance<A extends any[] = any[], R = any> extends SpyInstance<A, R> {
|
|
53
|
-
}
|
|
54
|
-
interface Mock<TArgs extends any[] = any, TReturns = any> extends SpyInstance<TArgs, TReturns> {
|
|
55
|
-
new (...args: TArgs): TReturns;
|
|
56
|
-
(...args: TArgs): TReturns;
|
|
57
|
-
}
|
|
58
|
-
interface PartialMock<TArgs extends any[] = any, TReturns = any> extends SpyInstance<TArgs, Partial<TReturns>> {
|
|
59
|
-
new (...args: TArgs): TReturns;
|
|
60
|
-
(...args: TArgs): TReturns;
|
|
61
|
-
}
|
|
62
|
-
declare type MaybeMockedConstructor<T> = T extends new (...args: Array<any>) => infer R ? Mock<ConstructorParameters<T>, R> : T;
|
|
63
|
-
declare type MockedFunction<T extends Procedure> = Mock<Parameters<T>, ReturnType<T>> & {
|
|
64
|
-
[K in keyof T]: T[K];
|
|
65
|
-
};
|
|
66
|
-
declare type PartiallyMockedFunction<T extends Procedure> = PartialMock<Parameters<T>, ReturnType<T>> & {
|
|
67
|
-
[K in keyof T]: T[K];
|
|
68
|
-
};
|
|
69
|
-
declare type MockedFunctionDeep<T extends Procedure> = Mock<Parameters<T>, ReturnType<T>> & MockedObjectDeep<T>;
|
|
70
|
-
declare type PartiallyMockedFunctionDeep<T extends Procedure> = PartialMock<Parameters<T>, ReturnType<T>> & MockedObjectDeep<T>;
|
|
71
|
-
declare type MockedObject<T> = MaybeMockedConstructor<T> & {
|
|
72
|
-
[K in Methods<T>]: T[K] extends Procedure ? MockedFunction<T[K]> : T[K];
|
|
73
|
-
} & {
|
|
74
|
-
[K in Properties<T>]: T[K];
|
|
75
|
-
};
|
|
76
|
-
declare type MockedObjectDeep<T> = MaybeMockedConstructor<T> & {
|
|
77
|
-
[K in Methods<T>]: T[K] extends Procedure ? MockedFunctionDeep<T[K]> : T[K];
|
|
78
|
-
} & {
|
|
79
|
-
[K in Properties<T>]: MaybeMockedDeep<T[K]>;
|
|
80
|
-
};
|
|
81
|
-
declare type MaybeMockedDeep<T> = T extends Procedure ? MockedFunctionDeep<T> : T extends object ? MockedObjectDeep<T> : T;
|
|
82
|
-
declare type MaybePartiallyMockedDeep<T> = T extends Procedure ? PartiallyMockedFunctionDeep<T> : T extends object ? MockedObjectDeep<T> : T;
|
|
83
|
-
declare type MaybeMocked<T> = T extends Procedure ? MockedFunction<T> : T extends object ? MockedObject<T> : T;
|
|
84
|
-
declare type MaybePartiallyMocked<T> = T extends Procedure ? PartiallyMockedFunction<T> : T extends object ? MockedObject<T> : T;
|
|
85
|
-
interface Constructable {
|
|
86
|
-
new (...args: any[]): any;
|
|
87
|
-
}
|
|
88
|
-
declare type MockedClass<T extends Constructable> = MockInstance<T extends new (...args: infer P) => any ? P : never, InstanceType<T>> & {
|
|
89
|
-
prototype: T extends {
|
|
90
|
-
prototype: any;
|
|
91
|
-
} ? Mocked<T['prototype']> : never;
|
|
92
|
-
} & T;
|
|
93
|
-
declare type Mocked<T> = {
|
|
94
|
-
[P in keyof T]: T[P] extends (...args: infer Args) => infer Returns ? MockInstance<Args, Returns> : T[P] extends Constructable ? MockedClass<T[P]> : T[P];
|
|
95
|
-
} & T;
|
|
96
|
-
declare type EnhancedSpy<TArgs extends any[] = any[], TReturns = any> = SpyInstance<TArgs, TReturns> & SpyImpl<TArgs, TReturns>;
|
|
97
|
-
declare function spyOn<T, S extends Properties<Required<T>>>(obj: T, methodName: S, accessType: 'get'): SpyInstance<[], T[S]>;
|
|
98
|
-
declare function spyOn<T, G extends Properties<Required<T>>>(obj: T, methodName: G, accessType: 'set'): SpyInstance<[T[G]], void>;
|
|
99
|
-
declare function spyOn<T, M extends (Methods<Required<T>> | Classes<Required<T>>)>(obj: T, methodName: M): Required<T>[M] extends (...args: infer A) => infer R | (new (...args: infer A) => infer R) ? SpyInstance<A, R> : never;
|
|
100
|
-
declare function fn<TArgs extends any[] = any[], R = any>(): Mock<TArgs, R>;
|
|
101
|
-
declare function fn<TArgs extends any[] = any[], R = any>(implementation: (...args: TArgs) => R): Mock<TArgs, R>;
|
|
102
|
-
|
|
103
|
-
declare const suite: SuiteAPI<{}>;
|
|
104
|
-
declare const test: TestAPI<{}>;
|
|
105
|
-
declare const bench: BenchmarkAPI;
|
|
106
|
-
declare const describe: SuiteAPI<{}>;
|
|
107
|
-
declare const it: TestAPI<{}>;
|
|
108
|
-
|
|
109
|
-
declare const beforeAll: (fn: SuiteHooks['beforeAll'][0], timeout?: number) => void;
|
|
110
|
-
declare const afterAll: (fn: SuiteHooks['afterAll'][0], timeout?: number) => void;
|
|
111
|
-
declare const beforeEach: <ExtraContext = {}>(fn: HookListener<[TestContext & ExtraContext, Suite], HookCleanupCallback>, timeout?: number) => void;
|
|
112
|
-
declare const afterEach: <ExtraContext = {}>(fn: HookListener<[TestContext & ExtraContext, Suite], void>, timeout?: number) => void;
|
|
113
|
-
|
|
114
|
-
declare function createExpect(test?: Test): Vi.ExpectStatic;
|
|
115
|
-
declare const globalExpect: Vi.ExpectStatic;
|
|
116
|
-
|
|
117
|
-
export { EnhancedSpy as E, MaybeMockedDeep as M, SpyInstance as S, MaybeMocked as a, MaybePartiallyMocked as b, MaybePartiallyMockedDeep as c, suite as d, describe as e, fn as f, bench as g, beforeAll as h, it as i, afterAll as j, beforeEach as k, afterEach as l, globalExpect as m, createExpect as n, MockedFunction as o, MockedObject as p, MockInstance as q, Mock as r, spyOn as s, test as t, MockContext as u, Mocked as v, MockedClass as w };
|
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
2
|
-
import assert$1 from 'assert';
|
|
3
|
-
import require$$2 from 'events';
|
|
4
|
-
|
|
5
|
-
var signalExit = {exports: {}};
|
|
6
|
-
|
|
7
|
-
var signals$1 = {exports: {}};
|
|
8
|
-
|
|
9
|
-
var hasRequiredSignals;
|
|
10
|
-
|
|
11
|
-
function requireSignals () {
|
|
12
|
-
if (hasRequiredSignals) return signals$1.exports;
|
|
13
|
-
hasRequiredSignals = 1;
|
|
14
|
-
(function (module) {
|
|
15
|
-
// This is not the set of all possible signals.
|
|
16
|
-
//
|
|
17
|
-
// It IS, however, the set of all signals that trigger
|
|
18
|
-
// an exit on either Linux or BSD systems. Linux is a
|
|
19
|
-
// superset of the signal names supported on BSD, and
|
|
20
|
-
// the unknown signals just fail to register, so we can
|
|
21
|
-
// catch that easily enough.
|
|
22
|
-
//
|
|
23
|
-
// Don't bother with SIGKILL. It's uncatchable, which
|
|
24
|
-
// means that we can't fire any callbacks anyway.
|
|
25
|
-
//
|
|
26
|
-
// If a user does happen to register a handler on a non-
|
|
27
|
-
// fatal signal like SIGWINCH or something, and then
|
|
28
|
-
// exit, it'll end up firing `process.emit('exit')`, so
|
|
29
|
-
// the handler will be fired anyway.
|
|
30
|
-
//
|
|
31
|
-
// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
32
|
-
// artificially, inherently leave the process in a
|
|
33
|
-
// state from which it is not safe to try and enter JS
|
|
34
|
-
// listeners.
|
|
35
|
-
module.exports = [
|
|
36
|
-
'SIGABRT',
|
|
37
|
-
'SIGALRM',
|
|
38
|
-
'SIGHUP',
|
|
39
|
-
'SIGINT',
|
|
40
|
-
'SIGTERM'
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
if (process.platform !== 'win32') {
|
|
44
|
-
module.exports.push(
|
|
45
|
-
'SIGVTALRM',
|
|
46
|
-
'SIGXCPU',
|
|
47
|
-
'SIGXFSZ',
|
|
48
|
-
'SIGUSR2',
|
|
49
|
-
'SIGTRAP',
|
|
50
|
-
'SIGSYS',
|
|
51
|
-
'SIGQUIT',
|
|
52
|
-
'SIGIOT'
|
|
53
|
-
// should detect profiler and enable/disable accordingly.
|
|
54
|
-
// see #21
|
|
55
|
-
// 'SIGPROF'
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (process.platform === 'linux') {
|
|
60
|
-
module.exports.push(
|
|
61
|
-
'SIGIO',
|
|
62
|
-
'SIGPOLL',
|
|
63
|
-
'SIGPWR',
|
|
64
|
-
'SIGSTKFLT',
|
|
65
|
-
'SIGUNUSED'
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
} (signals$1));
|
|
69
|
-
return signals$1.exports;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Note: since nyc uses this module to output coverage, any lines
|
|
73
|
-
// that are in the direct sync flow of nyc's outputCoverage are
|
|
74
|
-
// ignored, since we can never get coverage for them.
|
|
75
|
-
// grab a reference to node's real process object right away
|
|
76
|
-
var process$1 = commonjsGlobal.process;
|
|
77
|
-
|
|
78
|
-
const processOk = function (process) {
|
|
79
|
-
return process &&
|
|
80
|
-
typeof process === 'object' &&
|
|
81
|
-
typeof process.removeListener === 'function' &&
|
|
82
|
-
typeof process.emit === 'function' &&
|
|
83
|
-
typeof process.reallyExit === 'function' &&
|
|
84
|
-
typeof process.listeners === 'function' &&
|
|
85
|
-
typeof process.kill === 'function' &&
|
|
86
|
-
typeof process.pid === 'number' &&
|
|
87
|
-
typeof process.on === 'function'
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// some kind of non-node environment, just no-op
|
|
91
|
-
/* istanbul ignore if */
|
|
92
|
-
if (!processOk(process$1)) {
|
|
93
|
-
signalExit.exports = function () {
|
|
94
|
-
return function () {}
|
|
95
|
-
};
|
|
96
|
-
} else {
|
|
97
|
-
var assert = assert$1;
|
|
98
|
-
var signals = requireSignals();
|
|
99
|
-
var isWin = /^win/i.test(process$1.platform);
|
|
100
|
-
|
|
101
|
-
var EE = require$$2;
|
|
102
|
-
/* istanbul ignore if */
|
|
103
|
-
if (typeof EE !== 'function') {
|
|
104
|
-
EE = EE.EventEmitter;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
var emitter;
|
|
108
|
-
if (process$1.__signal_exit_emitter__) {
|
|
109
|
-
emitter = process$1.__signal_exit_emitter__;
|
|
110
|
-
} else {
|
|
111
|
-
emitter = process$1.__signal_exit_emitter__ = new EE();
|
|
112
|
-
emitter.count = 0;
|
|
113
|
-
emitter.emitted = {};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// Because this emitter is a global, we have to check to see if a
|
|
117
|
-
// previous version of this library failed to enable infinite listeners.
|
|
118
|
-
// I know what you're about to say. But literally everything about
|
|
119
|
-
// signal-exit is a compromise with evil. Get used to it.
|
|
120
|
-
if (!emitter.infinite) {
|
|
121
|
-
emitter.setMaxListeners(Infinity);
|
|
122
|
-
emitter.infinite = true;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
signalExit.exports = function (cb, opts) {
|
|
126
|
-
/* istanbul ignore if */
|
|
127
|
-
if (!processOk(commonjsGlobal.process)) {
|
|
128
|
-
return function () {}
|
|
129
|
-
}
|
|
130
|
-
assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler');
|
|
131
|
-
|
|
132
|
-
if (loaded === false) {
|
|
133
|
-
load();
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
var ev = 'exit';
|
|
137
|
-
if (opts && opts.alwaysLast) {
|
|
138
|
-
ev = 'afterexit';
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
var remove = function () {
|
|
142
|
-
emitter.removeListener(ev, cb);
|
|
143
|
-
if (emitter.listeners('exit').length === 0 &&
|
|
144
|
-
emitter.listeners('afterexit').length === 0) {
|
|
145
|
-
unload();
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
emitter.on(ev, cb);
|
|
149
|
-
|
|
150
|
-
return remove
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
var unload = function unload () {
|
|
154
|
-
if (!loaded || !processOk(commonjsGlobal.process)) {
|
|
155
|
-
return
|
|
156
|
-
}
|
|
157
|
-
loaded = false;
|
|
158
|
-
|
|
159
|
-
signals.forEach(function (sig) {
|
|
160
|
-
try {
|
|
161
|
-
process$1.removeListener(sig, sigListeners[sig]);
|
|
162
|
-
} catch (er) {}
|
|
163
|
-
});
|
|
164
|
-
process$1.emit = originalProcessEmit;
|
|
165
|
-
process$1.reallyExit = originalProcessReallyExit;
|
|
166
|
-
emitter.count -= 1;
|
|
167
|
-
};
|
|
168
|
-
signalExit.exports.unload = unload;
|
|
169
|
-
|
|
170
|
-
var emit = function emit (event, code, signal) {
|
|
171
|
-
/* istanbul ignore if */
|
|
172
|
-
if (emitter.emitted[event]) {
|
|
173
|
-
return
|
|
174
|
-
}
|
|
175
|
-
emitter.emitted[event] = true;
|
|
176
|
-
emitter.emit(event, code, signal);
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
// { <signal>: <listener fn>, ... }
|
|
180
|
-
var sigListeners = {};
|
|
181
|
-
signals.forEach(function (sig) {
|
|
182
|
-
sigListeners[sig] = function listener () {
|
|
183
|
-
/* istanbul ignore if */
|
|
184
|
-
if (!processOk(commonjsGlobal.process)) {
|
|
185
|
-
return
|
|
186
|
-
}
|
|
187
|
-
// If there are no other listeners, an exit is coming!
|
|
188
|
-
// Simplest way: remove us and then re-send the signal.
|
|
189
|
-
// We know that this will kill the process, so we can
|
|
190
|
-
// safely emit now.
|
|
191
|
-
var listeners = process$1.listeners(sig);
|
|
192
|
-
if (listeners.length === emitter.count) {
|
|
193
|
-
unload();
|
|
194
|
-
emit('exit', null, sig);
|
|
195
|
-
/* istanbul ignore next */
|
|
196
|
-
emit('afterexit', null, sig);
|
|
197
|
-
/* istanbul ignore next */
|
|
198
|
-
if (isWin && sig === 'SIGHUP') {
|
|
199
|
-
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
200
|
-
// so use a supported signal instead
|
|
201
|
-
sig = 'SIGINT';
|
|
202
|
-
}
|
|
203
|
-
/* istanbul ignore next */
|
|
204
|
-
process$1.kill(process$1.pid, sig);
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
signalExit.exports.signals = function () {
|
|
210
|
-
return signals
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
var loaded = false;
|
|
214
|
-
|
|
215
|
-
var load = function load () {
|
|
216
|
-
if (loaded || !processOk(commonjsGlobal.process)) {
|
|
217
|
-
return
|
|
218
|
-
}
|
|
219
|
-
loaded = true;
|
|
220
|
-
|
|
221
|
-
// This is the number of onSignalExit's that are in play.
|
|
222
|
-
// It's important so that we can count the correct number of
|
|
223
|
-
// listeners on signals, and don't wait for the other one to
|
|
224
|
-
// handle it instead of us.
|
|
225
|
-
emitter.count += 1;
|
|
226
|
-
|
|
227
|
-
signals = signals.filter(function (sig) {
|
|
228
|
-
try {
|
|
229
|
-
process$1.on(sig, sigListeners[sig]);
|
|
230
|
-
return true
|
|
231
|
-
} catch (er) {
|
|
232
|
-
return false
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
process$1.emit = processEmit;
|
|
237
|
-
process$1.reallyExit = processReallyExit;
|
|
238
|
-
};
|
|
239
|
-
signalExit.exports.load = load;
|
|
240
|
-
|
|
241
|
-
var originalProcessReallyExit = process$1.reallyExit;
|
|
242
|
-
var processReallyExit = function processReallyExit (code) {
|
|
243
|
-
/* istanbul ignore if */
|
|
244
|
-
if (!processOk(commonjsGlobal.process)) {
|
|
245
|
-
return
|
|
246
|
-
}
|
|
247
|
-
process$1.exitCode = code || /* istanbul ignore next */ 0;
|
|
248
|
-
emit('exit', process$1.exitCode, null);
|
|
249
|
-
/* istanbul ignore next */
|
|
250
|
-
emit('afterexit', process$1.exitCode, null);
|
|
251
|
-
/* istanbul ignore next */
|
|
252
|
-
originalProcessReallyExit.call(process$1, process$1.exitCode);
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
var originalProcessEmit = process$1.emit;
|
|
256
|
-
var processEmit = function processEmit (ev, arg) {
|
|
257
|
-
if (ev === 'exit' && processOk(commonjsGlobal.process)) {
|
|
258
|
-
/* istanbul ignore else */
|
|
259
|
-
if (arg !== undefined) {
|
|
260
|
-
process$1.exitCode = arg;
|
|
261
|
-
}
|
|
262
|
-
var ret = originalProcessEmit.apply(this, arguments);
|
|
263
|
-
/* istanbul ignore next */
|
|
264
|
-
emit('exit', process$1.exitCode, null);
|
|
265
|
-
/* istanbul ignore next */
|
|
266
|
-
emit('afterexit', process$1.exitCode, null);
|
|
267
|
-
/* istanbul ignore next */
|
|
268
|
-
return ret
|
|
269
|
-
} else {
|
|
270
|
-
return originalProcessEmit.apply(this, arguments)
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
export { signalExit as s };
|