@accelint/design-system 0.12.1 → 0.12.3
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/dist/components/aria/index.d.ts +4 -4
- package/dist/components/aria/index.js +14 -7
- package/dist/components/aria/index.js.map +1 -1
- package/dist/components/button/index.js +13 -5
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/checkbox/index.js +16 -8
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/chip/index.js +20 -10
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/menu/index.js +12 -12
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/options/index.js +24 -12
- package/dist/components/options/index.js.map +1 -1
- package/dist/components/picker/index.js +15 -7
- package/dist/components/picker/index.js.map +1 -1
- package/dist/components/query-builder/group.js +1 -0
- package/dist/components/query-builder/group.js.map +1 -1
- package/dist/ladle/actions.js.map +1 -1
- package/dist/test/setup.js +260 -346
- package/dist/test/setup.js.map +1 -1
- package/package.json +10 -10
package/dist/test/setup.js
CHANGED
|
@@ -12,18 +12,16 @@ import 'react-dom';
|
|
|
12
12
|
import 'react-dom/client';
|
|
13
13
|
import * as prettyFormat from 'pretty-format.js';
|
|
14
14
|
import lzString from 'lz-string.js';
|
|
15
|
-
import { test, suite, onTestFinished, onTestFailed, it, describe, beforeEach, beforeAll as beforeAll$1, afterEach as afterEach$1, afterAll as afterAll$1, getCurrentSuite, getCurrentTest } from '@vitest/runner.js';
|
|
16
|
-
import { createChainable, getNames } from '@vitest/runner/utils.js';
|
|
17
|
-
import { noop, getSafeTimers, assertTypes, createSimpleStackTrace } from '@vitest/utils.js';
|
|
18
|
-
import 'pathe.js';
|
|
19
|
-
import * as chai$1 from 'chai.js';
|
|
20
|
-
import { should, assert } from 'chai.js';
|
|
21
15
|
import { JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT, ASYMMETRIC_MATCHERS_OBJECT, getState, setState, addCustomEqualityTesters, equals, iterableEquality, subsetEquality } from '@vitest/expect.js';
|
|
16
|
+
import { afterEach as afterEach$1, getCurrentTest } from '@vitest/runner.js';
|
|
17
|
+
import { getNames } from '@vitest/runner/utils.js';
|
|
18
|
+
import * as chai$1 from 'chai.js';
|
|
19
|
+
import { assertTypes, getSafeTimers, createSimpleStackTrace } from '@vitest/utils.js';
|
|
22
20
|
import { stripSnapshotIndentation, addSerializer, SnapshotClient } from '@vitest/snapshot.js';
|
|
23
21
|
import '@vitest/utils/error.js';
|
|
24
22
|
import { parseSingleStack } from '@vitest/utils/source-map.js';
|
|
25
23
|
import { fn, spyOn, mocks, isMockFunction } from '@vitest/spy.js';
|
|
26
|
-
import '
|
|
24
|
+
import 'expect-type.js';
|
|
27
25
|
|
|
28
26
|
// ../node_modules/.pnpm/@testing-library+jest-dom@6.6.3/node_modules/@testing-library/jest-dom/dist/matchers.mjs
|
|
29
27
|
var matchers_exports = {};
|
|
@@ -3879,7 +3877,7 @@ typeof document !== "undefined" && document.body ? getQueriesForElement(document
|
|
|
3879
3877
|
return helpers;
|
|
3880
3878
|
}, initialValue);
|
|
3881
3879
|
|
|
3882
|
-
// ../node_modules/.pnpm/@testing-library+react@16.3.0_@testing-library+dom@10.4.0_@types+react-dom@19.1.
|
|
3880
|
+
// ../node_modules/.pnpm/@testing-library+react@16.3.0_@testing-library+dom@10.4.0_@types+react-dom@19.1.1_@type_7493c477d8ee6200c9fe69ec2493f911/node_modules/@testing-library/react/dist/@testing-library/react.esm.js
|
|
3883
3881
|
var reactAct = typeof React.act === "function" ? React.act : DeprecatedReactTestUtils.act;
|
|
3884
3882
|
function getGlobalThis() {
|
|
3885
3883
|
if (typeof globalThis !== "undefined") {
|
|
@@ -4024,10 +4022,9 @@ if (typeof process === "undefined" || !process.env?.RTL_SKIP_AUTO_CLEANUP) {
|
|
|
4024
4022
|
});
|
|
4025
4023
|
}
|
|
4026
4024
|
}
|
|
4027
|
-
|
|
4028
|
-
// ../node_modules/.pnpm/vitest@2.1.3_@types+node@24.2.0_jsdom@25.0.1_lightningcss@1.30.1_msw@2.10.4_@types+node_bd31f00d24f7de9d4c3dd1b1abef4a27/node_modules/vitest/dist/chunks/utils.Ck2hJTRs.js
|
|
4025
|
+
var NAME_WORKER_STATE = "__vitest_worker__";
|
|
4029
4026
|
function getWorkerState() {
|
|
4030
|
-
const workerState = globalThis
|
|
4027
|
+
const workerState = globalThis[NAME_WORKER_STATE];
|
|
4031
4028
|
if (!workerState) {
|
|
4032
4029
|
const errorMsg = 'Vitest failed to access its internal state.\n\nOne of the following is possible:\n- "vitest" is imported directly without running "vitest" command\n- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context)\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n';
|
|
4033
4030
|
throw new Error(errorMsg);
|
|
@@ -4038,80 +4035,59 @@ function getCurrentEnvironment() {
|
|
|
4038
4035
|
const state = getWorkerState();
|
|
4039
4036
|
return state?.environment.name;
|
|
4040
4037
|
}
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
function getRunMode() {
|
|
4044
|
-
return getWorkerState().config.mode;
|
|
4045
|
-
}
|
|
4046
|
-
function isRunningInBenchmark() {
|
|
4047
|
-
return getRunMode() === "benchmark";
|
|
4038
|
+
function isChildProcess() {
|
|
4039
|
+
return typeof process !== "undefined" && !!process.send;
|
|
4048
4040
|
}
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4041
|
+
function resetModules(modules, resetMocks = false) {
|
|
4042
|
+
const skipPaths = [
|
|
4043
|
+
// Vitest
|
|
4044
|
+
/\/vitest\/dist\//,
|
|
4045
|
+
/\/vite-node\/dist\//,
|
|
4046
|
+
// yarn's .store folder
|
|
4047
|
+
/vitest-virtual-\w+\/dist/,
|
|
4048
|
+
// cnpm
|
|
4049
|
+
/@vitest\/dist/,
|
|
4050
|
+
// don't clear mocks
|
|
4051
|
+
...!resetMocks ? [/^mock:/] : []
|
|
4052
|
+
];
|
|
4053
|
+
modules.forEach((mod, path) => {
|
|
4054
|
+
if (skipPaths.some((re) => re.test(path))) {
|
|
4055
|
+
return;
|
|
4061
4056
|
}
|
|
4057
|
+
modules.invalidateModule(mod);
|
|
4062
4058
|
});
|
|
4063
|
-
benchFns.set(task, fn2);
|
|
4064
|
-
benchOptsMap.set(task, options);
|
|
4065
|
-
});
|
|
4066
|
-
function createBenchmark(fn2) {
|
|
4067
|
-
const benchmark = createChainable(
|
|
4068
|
-
["skip", "only", "todo"],
|
|
4069
|
-
fn2
|
|
4070
|
-
);
|
|
4071
|
-
benchmark.skipIf = (condition) => condition ? benchmark.skip : benchmark;
|
|
4072
|
-
benchmark.runIf = (condition) => condition ? benchmark : benchmark.skip;
|
|
4073
|
-
return benchmark;
|
|
4074
4059
|
}
|
|
4075
|
-
function
|
|
4076
|
-
|
|
4060
|
+
function waitNextTick() {
|
|
4061
|
+
const { setTimeout: setTimeout2 } = getSafeTimers();
|
|
4062
|
+
return new Promise((resolve) => setTimeout2(resolve, 0));
|
|
4077
4063
|
}
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
const
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
}
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
runOnce(() => {
|
|
4097
|
-
firstRun = true;
|
|
4098
|
-
}, "__vitest_first_run__");
|
|
4099
|
-
return firstRun;
|
|
4064
|
+
async function waitForImportsToResolve() {
|
|
4065
|
+
await waitNextTick();
|
|
4066
|
+
const state = getWorkerState();
|
|
4067
|
+
const promises = [];
|
|
4068
|
+
let resolvingCount = 0;
|
|
4069
|
+
for (const mod of state.moduleCache.values()) {
|
|
4070
|
+
if (mod.promise && !mod.evaluated) {
|
|
4071
|
+
promises.push(mod.promise);
|
|
4072
|
+
}
|
|
4073
|
+
if (mod.resolving) {
|
|
4074
|
+
resolvingCount++;
|
|
4075
|
+
}
|
|
4076
|
+
}
|
|
4077
|
+
if (!promises.length && !resolvingCount) {
|
|
4078
|
+
return;
|
|
4079
|
+
}
|
|
4080
|
+
await Promise.allSettled(promises);
|
|
4081
|
+
await waitForImportsToResolve();
|
|
4100
4082
|
}
|
|
4101
4083
|
|
|
4102
|
-
// ../node_modules/.pnpm/vitest@2.1.
|
|
4084
|
+
// ../node_modules/.pnpm/vitest@2.1.9_@types+node@24.6.2_jsdom@25.0.1_msw@2.11.3_@types+node@24.6.2_typescript@5.8.3_/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js
|
|
4103
4085
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
4104
4086
|
function getDefaultExportFromCjs(x) {
|
|
4105
4087
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
4106
4088
|
}
|
|
4107
|
-
function getTestName(task, separator = " > ") {
|
|
4108
|
-
return getNames(task).slice(1).join(separator);
|
|
4109
|
-
}
|
|
4110
|
-
function isChildProcess() {
|
|
4111
|
-
return typeof process !== "undefined" && !!process.send;
|
|
4112
|
-
}
|
|
4113
4089
|
|
|
4114
|
-
// ../node_modules/.pnpm/vitest@2.1.
|
|
4090
|
+
// ../node_modules/.pnpm/vitest@2.1.9_@types+node@24.6.2_jsdom@25.0.1_msw@2.11.3_@types+node@24.6.2_typescript@5.8.3_/node_modules/vitest/dist/chunks/date.W2xKR2qe.js
|
|
4115
4091
|
var RealDate = Date;
|
|
4116
4092
|
var now = null;
|
|
4117
4093
|
var MockDate = class _MockDate extends RealDate {
|
|
@@ -4163,47 +4139,130 @@ function mockDate(date) {
|
|
|
4163
4139
|
function resetDate() {
|
|
4164
4140
|
globalThis.Date = RealDate;
|
|
4165
4141
|
}
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4142
|
+
var unsupported = [
|
|
4143
|
+
// .poll is meant to retry matchers until they succeed, and
|
|
4144
|
+
// snapshots will always succeed as long as the poll method doesn't thow an error
|
|
4145
|
+
// in this case using the `vi.waitFor` method is more appropriate
|
|
4146
|
+
"matchSnapshot",
|
|
4147
|
+
"toMatchSnapshot",
|
|
4148
|
+
"toMatchInlineSnapshot",
|
|
4149
|
+
"toThrowErrorMatchingSnapshot",
|
|
4150
|
+
"toThrowErrorMatchingInlineSnapshot",
|
|
4151
|
+
// toThrow will never succeed because we call the poll callback until it doesn't throw
|
|
4152
|
+
"throws",
|
|
4153
|
+
"Throw",
|
|
4154
|
+
"throw",
|
|
4155
|
+
"toThrow",
|
|
4156
|
+
"toThrowError"
|
|
4157
|
+
// these are not supported because you can call them without `.poll`,
|
|
4158
|
+
// we throw an error inside the rejects/resolves methods to prevent this
|
|
4159
|
+
// rejects,
|
|
4160
|
+
// resolves
|
|
4161
|
+
];
|
|
4162
|
+
function createExpectPoll(expect2) {
|
|
4163
|
+
return function poll(fn2, options = {}) {
|
|
4164
|
+
const state = getWorkerState();
|
|
4165
|
+
const defaults = state.config.expect?.poll ?? {};
|
|
4166
|
+
const {
|
|
4167
|
+
interval = defaults.interval ?? 50,
|
|
4168
|
+
timeout = defaults.timeout ?? 1e3,
|
|
4169
|
+
message
|
|
4170
|
+
} = options;
|
|
4171
|
+
const assertion = expect2(null, message).withContext({
|
|
4172
|
+
poll: true
|
|
4173
|
+
});
|
|
4174
|
+
fn2 = fn2.bind(assertion);
|
|
4175
|
+
const test2 = chai$1.util.flag(assertion, "vitest-test");
|
|
4176
|
+
if (!test2) {
|
|
4177
|
+
throw new Error("expect.poll() must be called inside a test");
|
|
4181
4178
|
}
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4179
|
+
const proxy = new Proxy(assertion, {
|
|
4180
|
+
get(target, key, receiver) {
|
|
4181
|
+
const assertionFunction = Reflect.get(target, key, receiver);
|
|
4182
|
+
if (typeof assertionFunction !== "function") {
|
|
4183
|
+
return assertionFunction instanceof chai$1.Assertion ? proxy : assertionFunction;
|
|
4184
|
+
}
|
|
4185
|
+
if (key === "assert") {
|
|
4186
|
+
return assertionFunction;
|
|
4187
|
+
}
|
|
4188
|
+
if (typeof key === "string" && unsupported.includes(key)) {
|
|
4189
|
+
throw new SyntaxError(
|
|
4190
|
+
`expect.poll() is not supported in combination with .${key}(). Use vi.waitFor() if your assertion condition is unstable.`
|
|
4191
|
+
);
|
|
4192
|
+
}
|
|
4193
|
+
return function(...args) {
|
|
4194
|
+
const STACK_TRACE_ERROR = new Error("STACK_TRACE_ERROR");
|
|
4195
|
+
const promise = () => new Promise((resolve, reject) => {
|
|
4196
|
+
let intervalId;
|
|
4197
|
+
let lastError;
|
|
4198
|
+
const { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = getSafeTimers();
|
|
4199
|
+
const timeoutId = setTimeout2(() => {
|
|
4200
|
+
clearTimeout2(intervalId);
|
|
4201
|
+
reject(
|
|
4202
|
+
copyStackTrace$1(
|
|
4203
|
+
new Error(`Matcher did not succeed in ${timeout}ms`, {
|
|
4204
|
+
cause: lastError
|
|
4205
|
+
}),
|
|
4206
|
+
STACK_TRACE_ERROR
|
|
4207
|
+
)
|
|
4208
|
+
);
|
|
4209
|
+
}, timeout);
|
|
4210
|
+
const check = async () => {
|
|
4211
|
+
try {
|
|
4212
|
+
chai$1.util.flag(assertion, "_name", key);
|
|
4213
|
+
const obj = await fn2();
|
|
4214
|
+
chai$1.util.flag(assertion, "object", obj);
|
|
4215
|
+
resolve(await assertionFunction.call(assertion, ...args));
|
|
4216
|
+
clearTimeout2(intervalId);
|
|
4217
|
+
clearTimeout2(timeoutId);
|
|
4218
|
+
} catch (err) {
|
|
4219
|
+
lastError = err;
|
|
4220
|
+
intervalId = setTimeout2(check, interval);
|
|
4221
|
+
}
|
|
4222
|
+
};
|
|
4223
|
+
check();
|
|
4224
|
+
});
|
|
4225
|
+
let awaited = false;
|
|
4226
|
+
test2.onFinished ??= [];
|
|
4227
|
+
test2.onFinished.push(() => {
|
|
4228
|
+
if (!awaited) {
|
|
4229
|
+
const negated = chai$1.util.flag(assertion, "negate") ? "not." : "";
|
|
4230
|
+
const name = chai$1.util.flag(assertion, "_poll.element") ? "element(locator)" : "poll(assertion)";
|
|
4231
|
+
const assertionString = `expect.${name}.${negated}${String(key)}()`;
|
|
4232
|
+
const error = new Error(
|
|
4233
|
+
`${assertionString} was not awaited. This assertion is asynchronous and must be awaited; otherwise, it is not executed to avoid unhandled rejections:
|
|
4234
|
+
|
|
4235
|
+
await ${assertionString}
|
|
4236
|
+
`
|
|
4237
|
+
);
|
|
4238
|
+
throw copyStackTrace$1(error, STACK_TRACE_ERROR);
|
|
4239
|
+
}
|
|
4240
|
+
});
|
|
4241
|
+
let resultPromise;
|
|
4242
|
+
return {
|
|
4243
|
+
then(onFulfilled, onRejected) {
|
|
4244
|
+
awaited = true;
|
|
4245
|
+
return (resultPromise ||= promise()).then(onFulfilled, onRejected);
|
|
4246
|
+
},
|
|
4247
|
+
catch(onRejected) {
|
|
4248
|
+
return (resultPromise ||= promise()).catch(onRejected);
|
|
4249
|
+
},
|
|
4250
|
+
finally(onFinally) {
|
|
4251
|
+
return (resultPromise ||= promise()).finally(onFinally);
|
|
4252
|
+
},
|
|
4253
|
+
[Symbol.toStringTag]: "Promise"
|
|
4254
|
+
};
|
|
4255
|
+
};
|
|
4256
|
+
}
|
|
4257
|
+
});
|
|
4258
|
+
return proxy;
|
|
4259
|
+
};
|
|
4188
4260
|
}
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
const promises = [];
|
|
4193
|
-
let resolvingCount = 0;
|
|
4194
|
-
for (const mod of state.moduleCache.values()) {
|
|
4195
|
-
if (mod.promise && !mod.evaluated) {
|
|
4196
|
-
promises.push(mod.promise);
|
|
4197
|
-
}
|
|
4198
|
-
if (mod.resolving) {
|
|
4199
|
-
resolvingCount++;
|
|
4200
|
-
}
|
|
4201
|
-
}
|
|
4202
|
-
if (!promises.length && !resolvingCount) {
|
|
4203
|
-
return;
|
|
4261
|
+
function copyStackTrace$1(target, source) {
|
|
4262
|
+
if (source.stack !== void 0) {
|
|
4263
|
+
target.stack = source.stack.replace(source.message, target.message);
|
|
4204
4264
|
}
|
|
4205
|
-
|
|
4206
|
-
await waitForImportsToResolve();
|
|
4265
|
+
return target;
|
|
4207
4266
|
}
|
|
4208
4267
|
function commonjsRequire(path) {
|
|
4209
4268
|
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
@@ -4222,12 +4281,12 @@ function requireChaiSubset() {
|
|
|
4222
4281
|
} else {
|
|
4223
4282
|
return chai.use(chaiSubset2);
|
|
4224
4283
|
}
|
|
4225
|
-
})(function(
|
|
4226
|
-
var Assertion2 =
|
|
4284
|
+
})(function(chai3, utils) {
|
|
4285
|
+
var Assertion2 = chai3.Assertion;
|
|
4227
4286
|
var assertionPrototype = Assertion2.prototype;
|
|
4228
4287
|
Assertion2.addMethod("containSubset", function(expected) {
|
|
4229
4288
|
var actual = utils.flag(this, "object");
|
|
4230
|
-
var showDiff =
|
|
4289
|
+
var showDiff = chai3.config.showDiff;
|
|
4231
4290
|
assertionPrototype.assert.call(
|
|
4232
4291
|
this,
|
|
4233
4292
|
compare(expected, actual),
|
|
@@ -4238,8 +4297,8 @@ function requireChaiSubset() {
|
|
|
4238
4297
|
showDiff
|
|
4239
4298
|
);
|
|
4240
4299
|
});
|
|
4241
|
-
|
|
4242
|
-
new
|
|
4300
|
+
chai3.assert.containSubset = function(val, exp, msg) {
|
|
4301
|
+
new chai3.Assertion(val, msg).to.be.containSubset(exp);
|
|
4243
4302
|
};
|
|
4244
4303
|
function compare(expected, actual) {
|
|
4245
4304
|
if (expected === actual) {
|
|
@@ -4291,18 +4350,56 @@ function requireChaiSubset() {
|
|
|
4291
4350
|
}
|
|
4292
4351
|
var chaiSubsetExports = requireChaiSubset();
|
|
4293
4352
|
var Subset = /* @__PURE__ */ getDefaultExportFromCjs(chaiSubsetExports);
|
|
4294
|
-
function
|
|
4295
|
-
|
|
4353
|
+
function createAssertionMessage(util2, assertion, hasArgs) {
|
|
4354
|
+
const not = util2.flag(assertion, "negate") ? "not." : "";
|
|
4355
|
+
const name = `${util2.flag(assertion, "_name")}(${"expected"})`;
|
|
4356
|
+
const promiseName = util2.flag(assertion, "promise");
|
|
4357
|
+
const promise = promiseName ? `.${promiseName}` : "";
|
|
4358
|
+
return `expect(actual)${promise}.${not}${name}`;
|
|
4359
|
+
}
|
|
4360
|
+
function recordAsyncExpect(_test, promise, assertion, error) {
|
|
4361
|
+
const test2 = _test;
|
|
4362
|
+
if (test2 && promise instanceof Promise) {
|
|
4296
4363
|
promise = promise.finally(() => {
|
|
4297
|
-
|
|
4364
|
+
if (!test2.promises) {
|
|
4365
|
+
return;
|
|
4366
|
+
}
|
|
4367
|
+
const index = test2.promises.indexOf(promise);
|
|
4298
4368
|
if (index !== -1) {
|
|
4299
|
-
|
|
4369
|
+
test2.promises.splice(index, 1);
|
|
4300
4370
|
}
|
|
4301
4371
|
});
|
|
4302
|
-
if (!
|
|
4303
|
-
|
|
4304
|
-
}
|
|
4305
|
-
|
|
4372
|
+
if (!test2.promises) {
|
|
4373
|
+
test2.promises = [];
|
|
4374
|
+
}
|
|
4375
|
+
test2.promises.push(promise);
|
|
4376
|
+
let resolved = false;
|
|
4377
|
+
test2.onFinished ??= [];
|
|
4378
|
+
test2.onFinished.push(() => {
|
|
4379
|
+
if (!resolved) {
|
|
4380
|
+
const processor = globalThis.__vitest_worker__?.onFilterStackTrace || ((s) => s || "");
|
|
4381
|
+
const stack = processor(error.stack);
|
|
4382
|
+
console.warn([
|
|
4383
|
+
`Promise returned by \`${assertion}\` was not awaited. `,
|
|
4384
|
+
"Vitest currently auto-awaits hanging assertions at the end of the test, but this will cause the test to fail in Vitest 3. ",
|
|
4385
|
+
"Please remember to await the assertion.\n",
|
|
4386
|
+
stack
|
|
4387
|
+
].join(""));
|
|
4388
|
+
}
|
|
4389
|
+
});
|
|
4390
|
+
return {
|
|
4391
|
+
then(onFullfilled, onRejected) {
|
|
4392
|
+
resolved = true;
|
|
4393
|
+
return promise.then(onFullfilled, onRejected);
|
|
4394
|
+
},
|
|
4395
|
+
catch(onRejected) {
|
|
4396
|
+
return promise.catch(onRejected);
|
|
4397
|
+
},
|
|
4398
|
+
finally(onFinally) {
|
|
4399
|
+
return promise.finally(onFinally);
|
|
4400
|
+
},
|
|
4401
|
+
[Symbol.toStringTag]: "Promise"
|
|
4402
|
+
};
|
|
4306
4403
|
}
|
|
4307
4404
|
return promise;
|
|
4308
4405
|
}
|
|
@@ -4333,27 +4430,28 @@ function getError(expected, promise) {
|
|
|
4333
4430
|
}
|
|
4334
4431
|
throw new Error("snapshot function didn't throw");
|
|
4335
4432
|
}
|
|
4336
|
-
function getTestNames(
|
|
4337
|
-
if (!
|
|
4433
|
+
function getTestNames(test2) {
|
|
4434
|
+
if (!test2) {
|
|
4338
4435
|
return {};
|
|
4339
4436
|
}
|
|
4340
4437
|
return {
|
|
4341
|
-
filepath:
|
|
4342
|
-
name: getNames(
|
|
4438
|
+
filepath: test2.file.filepath,
|
|
4439
|
+
name: getNames(test2).slice(1).join(" > ")
|
|
4343
4440
|
};
|
|
4344
4441
|
}
|
|
4345
|
-
var SnapshotPlugin = (
|
|
4442
|
+
var SnapshotPlugin = (chai3, utils) => {
|
|
4346
4443
|
for (const key of ["matchSnapshot", "toMatchSnapshot"]) {
|
|
4347
4444
|
utils.addMethod(
|
|
4348
|
-
|
|
4445
|
+
chai3.Assertion.prototype,
|
|
4349
4446
|
key,
|
|
4350
4447
|
function(properties, message) {
|
|
4448
|
+
utils.flag(this, "_name", key);
|
|
4351
4449
|
const isNot = utils.flag(this, "negate");
|
|
4352
4450
|
if (isNot) {
|
|
4353
4451
|
throw new Error(`${key} cannot be used with "not"`);
|
|
4354
4452
|
}
|
|
4355
4453
|
const expected = utils.flag(this, "object");
|
|
4356
|
-
const
|
|
4454
|
+
const test2 = utils.flag(this, "vitest-test");
|
|
4357
4455
|
if (typeof properties === "string" && typeof message === "undefined") {
|
|
4358
4456
|
message = properties;
|
|
4359
4457
|
properties = void 0;
|
|
@@ -4365,21 +4463,23 @@ var SnapshotPlugin = (chai4, utils) => {
|
|
|
4365
4463
|
isInline: false,
|
|
4366
4464
|
properties,
|
|
4367
4465
|
errorMessage,
|
|
4368
|
-
...getTestNames(
|
|
4466
|
+
...getTestNames(test2)
|
|
4369
4467
|
});
|
|
4370
4468
|
}
|
|
4371
4469
|
);
|
|
4372
4470
|
}
|
|
4373
4471
|
utils.addMethod(
|
|
4374
|
-
|
|
4472
|
+
chai3.Assertion.prototype,
|
|
4375
4473
|
"toMatchFileSnapshot",
|
|
4376
4474
|
function(file, message) {
|
|
4475
|
+
utils.flag(this, "_name", "toMatchFileSnapshot");
|
|
4377
4476
|
const isNot = utils.flag(this, "negate");
|
|
4378
4477
|
if (isNot) {
|
|
4379
4478
|
throw new Error('toMatchFileSnapshot cannot be used with "not"');
|
|
4380
4479
|
}
|
|
4480
|
+
const error = new Error("resolves");
|
|
4381
4481
|
const expected = utils.flag(this, "object");
|
|
4382
|
-
const
|
|
4482
|
+
const test2 = utils.flag(this, "vitest-test");
|
|
4383
4483
|
const errorMessage = utils.flag(this, "message");
|
|
4384
4484
|
const promise = getSnapshotClient().assertRaw({
|
|
4385
4485
|
received: expected,
|
|
@@ -4389,21 +4489,27 @@ var SnapshotPlugin = (chai4, utils) => {
|
|
|
4389
4489
|
file
|
|
4390
4490
|
},
|
|
4391
4491
|
errorMessage,
|
|
4392
|
-
...getTestNames(
|
|
4492
|
+
...getTestNames(test2)
|
|
4393
4493
|
});
|
|
4394
|
-
return recordAsyncExpect(
|
|
4494
|
+
return recordAsyncExpect(
|
|
4495
|
+
test2,
|
|
4496
|
+
promise,
|
|
4497
|
+
createAssertionMessage(utils, this),
|
|
4498
|
+
error
|
|
4499
|
+
);
|
|
4395
4500
|
}
|
|
4396
4501
|
);
|
|
4397
4502
|
utils.addMethod(
|
|
4398
|
-
|
|
4503
|
+
chai3.Assertion.prototype,
|
|
4399
4504
|
"toMatchInlineSnapshot",
|
|
4400
4505
|
function __INLINE_SNAPSHOT__(properties, inlineSnapshot, message) {
|
|
4506
|
+
utils.flag(this, "_name", "toMatchInlineSnapshot");
|
|
4401
4507
|
const isNot = utils.flag(this, "negate");
|
|
4402
4508
|
if (isNot) {
|
|
4403
4509
|
throw new Error('toMatchInlineSnapshot cannot be used with "not"');
|
|
4404
4510
|
}
|
|
4405
|
-
const
|
|
4406
|
-
const isInsideEach =
|
|
4511
|
+
const test2 = utils.flag(this, "vitest-test");
|
|
4512
|
+
const isInsideEach = test2 && (test2.each || test2.suite?.each);
|
|
4407
4513
|
if (isInsideEach) {
|
|
4408
4514
|
throw new Error(
|
|
4409
4515
|
"InlineSnapshot cannot be used inside of test.each or describe.each"
|
|
@@ -4428,14 +4534,15 @@ var SnapshotPlugin = (chai4, utils) => {
|
|
|
4428
4534
|
inlineSnapshot,
|
|
4429
4535
|
error,
|
|
4430
4536
|
errorMessage,
|
|
4431
|
-
...getTestNames(
|
|
4537
|
+
...getTestNames(test2)
|
|
4432
4538
|
});
|
|
4433
4539
|
}
|
|
4434
4540
|
);
|
|
4435
4541
|
utils.addMethod(
|
|
4436
|
-
|
|
4542
|
+
chai3.Assertion.prototype,
|
|
4437
4543
|
"toThrowErrorMatchingSnapshot",
|
|
4438
4544
|
function(message) {
|
|
4545
|
+
utils.flag(this, "_name", "toThrowErrorMatchingSnapshot");
|
|
4439
4546
|
const isNot = utils.flag(this, "negate");
|
|
4440
4547
|
if (isNot) {
|
|
4441
4548
|
throw new Error(
|
|
@@ -4443,19 +4550,19 @@ var SnapshotPlugin = (chai4, utils) => {
|
|
|
4443
4550
|
);
|
|
4444
4551
|
}
|
|
4445
4552
|
const expected = utils.flag(this, "object");
|
|
4446
|
-
const
|
|
4553
|
+
const test2 = utils.flag(this, "vitest-test");
|
|
4447
4554
|
const promise = utils.flag(this, "promise");
|
|
4448
4555
|
const errorMessage = utils.flag(this, "message");
|
|
4449
4556
|
getSnapshotClient().assert({
|
|
4450
4557
|
received: getError(expected, promise),
|
|
4451
4558
|
message,
|
|
4452
4559
|
errorMessage,
|
|
4453
|
-
...getTestNames(
|
|
4560
|
+
...getTestNames(test2)
|
|
4454
4561
|
});
|
|
4455
4562
|
}
|
|
4456
4563
|
);
|
|
4457
4564
|
utils.addMethod(
|
|
4458
|
-
|
|
4565
|
+
chai3.Assertion.prototype,
|
|
4459
4566
|
"toThrowErrorMatchingInlineSnapshot",
|
|
4460
4567
|
function __INLINE_SNAPSHOT__(inlineSnapshot, message) {
|
|
4461
4568
|
const isNot = utils.flag(this, "negate");
|
|
@@ -4464,8 +4571,8 @@ var SnapshotPlugin = (chai4, utils) => {
|
|
|
4464
4571
|
'toThrowErrorMatchingInlineSnapshot cannot be used with "not"'
|
|
4465
4572
|
);
|
|
4466
4573
|
}
|
|
4467
|
-
const
|
|
4468
|
-
const isInsideEach =
|
|
4574
|
+
const test2 = utils.flag(this, "vitest-test");
|
|
4575
|
+
const isInsideEach = test2 && (test2.each || test2.suite?.each);
|
|
4469
4576
|
if (isInsideEach) {
|
|
4470
4577
|
throw new Error(
|
|
4471
4578
|
"InlineSnapshot cannot be used inside of test.each or describe.each"
|
|
@@ -4485,114 +4592,23 @@ var SnapshotPlugin = (chai4, utils) => {
|
|
|
4485
4592
|
isInline: true,
|
|
4486
4593
|
error,
|
|
4487
4594
|
errorMessage,
|
|
4488
|
-
...getTestNames(
|
|
4595
|
+
...getTestNames(test2)
|
|
4489
4596
|
});
|
|
4490
4597
|
}
|
|
4491
4598
|
);
|
|
4492
|
-
utils.addMethod(
|
|
4599
|
+
utils.addMethod(chai3.expect, "addSnapshotSerializer", addSerializer);
|
|
4493
4600
|
};
|
|
4494
4601
|
chai$1.use(JestExtend);
|
|
4495
4602
|
chai$1.use(JestChaiExpect);
|
|
4496
4603
|
chai$1.use(Subset);
|
|
4497
4604
|
chai$1.use(SnapshotPlugin);
|
|
4498
4605
|
chai$1.use(JestAsymmetricMatchers);
|
|
4499
|
-
|
|
4500
|
-
// .poll is meant to retry matchers until they succeed, and
|
|
4501
|
-
// snapshots will always succeed as long as the poll method doesn't thow an error
|
|
4502
|
-
// in this case using the `vi.waitFor` method is more appropriate
|
|
4503
|
-
"matchSnapshot",
|
|
4504
|
-
"toMatchSnapshot",
|
|
4505
|
-
"toMatchInlineSnapshot",
|
|
4506
|
-
"toThrowErrorMatchingSnapshot",
|
|
4507
|
-
"toThrowErrorMatchingInlineSnapshot",
|
|
4508
|
-
// toThrow will never succeed because we call the poll callback until it doesn't throw
|
|
4509
|
-
"throws",
|
|
4510
|
-
"Throw",
|
|
4511
|
-
"throw",
|
|
4512
|
-
"toThrow",
|
|
4513
|
-
"toThrowError"
|
|
4514
|
-
// these are not supported because you can call them without `.poll`,
|
|
4515
|
-
// we throw an error inside the rejects/resolves methods to prevent this
|
|
4516
|
-
// rejects,
|
|
4517
|
-
// resolves
|
|
4518
|
-
];
|
|
4519
|
-
function createExpectPoll(expect2) {
|
|
4520
|
-
return function poll(fn2, options = {}) {
|
|
4521
|
-
const state = getWorkerState();
|
|
4522
|
-
const defaults = state.config.expect?.poll ?? {};
|
|
4523
|
-
const {
|
|
4524
|
-
interval = defaults.interval ?? 50,
|
|
4525
|
-
timeout = defaults.timeout ?? 1e3,
|
|
4526
|
-
message
|
|
4527
|
-
} = options;
|
|
4528
|
-
const assertion = expect2(null, message).withContext({
|
|
4529
|
-
poll: true
|
|
4530
|
-
});
|
|
4531
|
-
fn2 = fn2.bind(assertion);
|
|
4532
|
-
const proxy = new Proxy(assertion, {
|
|
4533
|
-
get(target, key, receiver) {
|
|
4534
|
-
const assertionFunction = Reflect.get(target, key, receiver);
|
|
4535
|
-
if (typeof assertionFunction !== "function") {
|
|
4536
|
-
return assertionFunction instanceof chai$1.Assertion ? proxy : assertionFunction;
|
|
4537
|
-
}
|
|
4538
|
-
if (key === "assert") {
|
|
4539
|
-
return assertionFunction;
|
|
4540
|
-
}
|
|
4541
|
-
if (typeof key === "string" && unsupported.includes(key)) {
|
|
4542
|
-
throw new SyntaxError(
|
|
4543
|
-
`expect.poll() is not supported in combination with .${key}(). Use vi.waitFor() if your assertion condition is unstable.`
|
|
4544
|
-
);
|
|
4545
|
-
}
|
|
4546
|
-
return function(...args) {
|
|
4547
|
-
const STACK_TRACE_ERROR = new Error("STACK_TRACE_ERROR");
|
|
4548
|
-
return new Promise((resolve, reject) => {
|
|
4549
|
-
let intervalId;
|
|
4550
|
-
let lastError;
|
|
4551
|
-
const { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = getSafeTimers();
|
|
4552
|
-
const timeoutId = setTimeout2(() => {
|
|
4553
|
-
clearTimeout2(intervalId);
|
|
4554
|
-
reject(
|
|
4555
|
-
copyStackTrace$1(
|
|
4556
|
-
new Error(`Matcher did not succeed in ${timeout}ms`, {
|
|
4557
|
-
cause: lastError
|
|
4558
|
-
}),
|
|
4559
|
-
STACK_TRACE_ERROR
|
|
4560
|
-
)
|
|
4561
|
-
);
|
|
4562
|
-
}, timeout);
|
|
4563
|
-
const check = async () => {
|
|
4564
|
-
try {
|
|
4565
|
-
chai$1.util.flag(assertion, "_name", key);
|
|
4566
|
-
const obj = await fn2();
|
|
4567
|
-
chai$1.util.flag(assertion, "object", obj);
|
|
4568
|
-
resolve(await assertionFunction.call(assertion, ...args));
|
|
4569
|
-
clearTimeout2(intervalId);
|
|
4570
|
-
clearTimeout2(timeoutId);
|
|
4571
|
-
} catch (err) {
|
|
4572
|
-
lastError = err;
|
|
4573
|
-
intervalId = setTimeout2(check, interval);
|
|
4574
|
-
}
|
|
4575
|
-
};
|
|
4576
|
-
check();
|
|
4577
|
-
});
|
|
4578
|
-
};
|
|
4579
|
-
}
|
|
4580
|
-
});
|
|
4581
|
-
return proxy;
|
|
4582
|
-
};
|
|
4583
|
-
}
|
|
4584
|
-
function copyStackTrace$1(target, source) {
|
|
4585
|
-
if (source.stack !== void 0) {
|
|
4586
|
-
target.stack = source.stack.replace(source.message, target.message);
|
|
4587
|
-
}
|
|
4588
|
-
return target;
|
|
4589
|
-
}
|
|
4590
|
-
function createExpect(test3) {
|
|
4606
|
+
function createExpect(test2) {
|
|
4591
4607
|
const expect2 = (value, message) => {
|
|
4592
4608
|
const { assertionCalls } = getState(expect2);
|
|
4593
4609
|
setState({ assertionCalls: assertionCalls + 1 }, expect2);
|
|
4594
4610
|
const assert22 = chai$1.expect(value, message);
|
|
4595
|
-
const _test =
|
|
4611
|
+
const _test = getCurrentTest();
|
|
4596
4612
|
if (_test) {
|
|
4597
4613
|
return assert22.withTest(_test);
|
|
4598
4614
|
} else {
|
|
@@ -4617,7 +4633,7 @@ function createExpect(test3) {
|
|
|
4617
4633
|
get testPath() {
|
|
4618
4634
|
return getWorkerState().filepath;
|
|
4619
4635
|
},
|
|
4620
|
-
currentTestName:
|
|
4636
|
+
currentTestName: globalState.currentTestName
|
|
4621
4637
|
},
|
|
4622
4638
|
expect2
|
|
4623
4639
|
);
|
|
@@ -4951,7 +4967,7 @@ function requireTypeDetect() {
|
|
|
4951
4967
|
(function(module2, exports) {
|
|
4952
4968
|
(function(global3, factory) {
|
|
4953
4969
|
module2.exports = factory();
|
|
4954
|
-
})(typeDetect, function() {
|
|
4970
|
+
})(typeDetect, (function() {
|
|
4955
4971
|
var promiseExists = typeof Promise === "function";
|
|
4956
4972
|
var globalObject = typeof self === "object" ? self : commonjsGlobal;
|
|
4957
4973
|
var symbolExists = typeof Symbol !== "undefined";
|
|
@@ -5060,7 +5076,7 @@ function requireTypeDetect() {
|
|
|
5060
5076
|
return Object.prototype.toString.call(obj).slice(toStringLeftSliceLength, toStringRightSliceLength);
|
|
5061
5077
|
}
|
|
5062
5078
|
return typeDetect2;
|
|
5063
|
-
});
|
|
5079
|
+
}));
|
|
5064
5080
|
})(typeDetect$1);
|
|
5065
5081
|
return typeDetect$1.exports;
|
|
5066
5082
|
}
|
|
@@ -6853,108 +6869,6 @@ function getImporter(name) {
|
|
|
6853
6869
|
const stack = parseSingleStack(stackArray[importerStackIndex + 1]);
|
|
6854
6870
|
return stack?.file || "";
|
|
6855
6871
|
}
|
|
6856
|
-
var dist = {};
|
|
6857
|
-
var hasRequiredDist;
|
|
6858
|
-
function requireDist() {
|
|
6859
|
-
if (hasRequiredDist) return dist;
|
|
6860
|
-
hasRequiredDist = 1;
|
|
6861
|
-
(function(exports) {
|
|
6862
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6863
|
-
exports.expectTypeOf = void 0;
|
|
6864
|
-
const fn2 = () => true;
|
|
6865
|
-
const expectTypeOf2 = (_actual) => {
|
|
6866
|
-
const nonFunctionProperties = [
|
|
6867
|
-
"parameters",
|
|
6868
|
-
"returns",
|
|
6869
|
-
"resolves",
|
|
6870
|
-
"not",
|
|
6871
|
-
"items",
|
|
6872
|
-
"constructorParameters",
|
|
6873
|
-
"thisParameter",
|
|
6874
|
-
"instance",
|
|
6875
|
-
"guards",
|
|
6876
|
-
"asserts",
|
|
6877
|
-
"branded"
|
|
6878
|
-
];
|
|
6879
|
-
const obj = {
|
|
6880
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
6881
|
-
toBeAny: fn2,
|
|
6882
|
-
toBeUnknown: fn2,
|
|
6883
|
-
toBeNever: fn2,
|
|
6884
|
-
toBeFunction: fn2,
|
|
6885
|
-
toBeObject: fn2,
|
|
6886
|
-
toBeArray: fn2,
|
|
6887
|
-
toBeString: fn2,
|
|
6888
|
-
toBeNumber: fn2,
|
|
6889
|
-
toBeBoolean: fn2,
|
|
6890
|
-
toBeVoid: fn2,
|
|
6891
|
-
toBeSymbol: fn2,
|
|
6892
|
-
toBeNull: fn2,
|
|
6893
|
-
toBeUndefined: fn2,
|
|
6894
|
-
toBeNullable: fn2,
|
|
6895
|
-
toMatchTypeOf: fn2,
|
|
6896
|
-
toEqualTypeOf: fn2,
|
|
6897
|
-
toBeCallableWith: fn2,
|
|
6898
|
-
toBeConstructibleWith: fn2,
|
|
6899
|
-
/* eslint-enable @typescript-eslint/no-unsafe-assignment */
|
|
6900
|
-
extract: exports.expectTypeOf,
|
|
6901
|
-
exclude: exports.expectTypeOf,
|
|
6902
|
-
pick: exports.expectTypeOf,
|
|
6903
|
-
omit: exports.expectTypeOf,
|
|
6904
|
-
toHaveProperty: exports.expectTypeOf,
|
|
6905
|
-
parameter: exports.expectTypeOf
|
|
6906
|
-
};
|
|
6907
|
-
const getterProperties = nonFunctionProperties;
|
|
6908
|
-
getterProperties.forEach((prop) => Object.defineProperty(obj, prop, { get: () => (0, exports.expectTypeOf)({}) }));
|
|
6909
|
-
return obj;
|
|
6910
|
-
};
|
|
6911
|
-
exports.expectTypeOf = expectTypeOf2;
|
|
6912
|
-
})(dist);
|
|
6913
|
-
return dist;
|
|
6914
|
-
}
|
|
6915
|
-
var distExports = requireDist();
|
|
6916
|
-
function noop2() {
|
|
6917
|
-
}
|
|
6918
|
-
var assertType = noop2;
|
|
6919
|
-
function getRunningMode() {
|
|
6920
|
-
return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";
|
|
6921
|
-
}
|
|
6922
|
-
function isWatchMode() {
|
|
6923
|
-
return getRunningMode() === "watch";
|
|
6924
|
-
}
|
|
6925
|
-
function inject(key) {
|
|
6926
|
-
const workerState = getWorkerState();
|
|
6927
|
-
return workerState.providedContext[key];
|
|
6928
|
-
}
|
|
6929
|
-
/* @__PURE__ */ Object.freeze({
|
|
6930
|
-
__proto__: null,
|
|
6931
|
-
afterAll: afterAll$1,
|
|
6932
|
-
afterEach: afterEach$1,
|
|
6933
|
-
assert: assert,
|
|
6934
|
-
assertType,
|
|
6935
|
-
beforeAll: beforeAll$1,
|
|
6936
|
-
beforeEach,
|
|
6937
|
-
bench,
|
|
6938
|
-
chai: chai$1,
|
|
6939
|
-
createExpect,
|
|
6940
|
-
describe,
|
|
6941
|
-
expect: globalExpect,
|
|
6942
|
-
expectTypeOf: distExports.expectTypeOf,
|
|
6943
|
-
getRunningMode,
|
|
6944
|
-
inject,
|
|
6945
|
-
isFirstRun,
|
|
6946
|
-
isWatchMode,
|
|
6947
|
-
it,
|
|
6948
|
-
onTestFailed,
|
|
6949
|
-
onTestFinished,
|
|
6950
|
-
runOnce,
|
|
6951
|
-
should,
|
|
6952
|
-
suite,
|
|
6953
|
-
test,
|
|
6954
|
-
vi,
|
|
6955
|
-
vitest
|
|
6956
|
-
});
|
|
6957
|
-
distExports.expectTypeOf;
|
|
6958
6872
|
|
|
6959
6873
|
// src/test/setup.ts
|
|
6960
6874
|
globalExpect.extend(matchers_exports);
|