chore(strongbox): Drop mocha (#22446)

This commit is contained in:
Mykola Mokhnach
2026-06-29 22:03:12 +02:00
committed by GitHub
parent 6699d1b266
commit 531b20a3c1
5 changed files with 20 additions and 31 deletions
+2 -2
View File
@@ -36,9 +36,9 @@
"scripts": {
"test": "run-p test:unit test:types",
"test:smoke": "node .",
"test:unit": "mocha \"test/unit/**/*.spec.ts\"",
"test:unit": "node --test --test-timeout=5000 \"./build/test/unit/**/*.spec.js\"",
"test:types": "tsd",
"test:e2e": "mocha --exit -t 20s \"test/e2e/**/*.e2e.spec.ts\""
"test:e2e": "node --test --test-force-exit --test-concurrency=1 --test-timeout=20000 \"./build/test/e2e/**/*.e2e.spec.js\""
},
"dependencies": {
"env-paths": "4.0.0"
@@ -1,18 +1,13 @@
import {readFile, rm} from 'node:fs/promises';
import type {Item, Strongbox} from '../../lib';
import {strongbox} from '../../lib';
import {describe, it, beforeEach, afterEach} from 'node:test';
import {expect, use} from 'chai';
import chaiAsPromised from 'chai-as-promised';
use(chaiAsPromised);
describe('@appium/strongbox', function () {
let expect: any;
before(async function () {
const chai = await import('chai');
const chaiAsPromised = await import('chai-as-promised');
chai.use(chaiAsPromised.default);
chai.should();
expect = chai.expect;
});
describe('default behavior', function () {
let box: Strongbox;
@@ -4,8 +4,13 @@ import type {BaseItem as TBaseItem} from '../../lib/base-item';
import type {SinonSandbox, SinonStubbedMember} from 'sinon';
import {createSandbox} from 'sinon';
import type fs from 'node:fs/promises';
import {describe, it, beforeEach} from 'node:test';
import {expect, use} from 'chai';
import chaiAsPromised from 'chai-as-promised';
import type {Item, Strongbox} from '../../lib';
use(chaiAsPromised);
type MockFs = {
[K in keyof typeof fs]: SinonStubbedMember<(typeof fs)[K]>;
};
@@ -16,15 +21,6 @@ describe('Strongbox', function () {
const DATA_DIR = path.resolve(path.sep, 'some', 'dir');
// note to self: looks like this is safe to do before the rewiremock.proxy call
let BaseItem: typeof TBaseItem;
let expect: any;
before(async function () {
const chai = await import('chai');
const chaiAsPromised = await import('chai-as-promised');
chai.use(chaiAsPromised.default);
chai.should();
expect = chai.expect;
});
beforeEach(function () {
sandbox = createSandbox();
@@ -4,6 +4,11 @@ import type {Strongbox as TStrongbox, StrongboxOpts, Item, Value} from '../../li
import type {SinonSandbox, SinonStubbedMember, SinonStub} from 'sinon';
import {createSandbox} from 'sinon';
import type fs from 'node:fs/promises';
import {describe, it, beforeEach, afterEach} from 'node:test';
import {expect, use} from 'chai';
import chaiAsPromised from 'chai-as-promised';
use(chaiAsPromised);
type MockFs = {
[K in keyof typeof fs]: SinonStubbedMember<(typeof fs)[K]>;
@@ -15,16 +20,9 @@ describe('Strongbox', function () {
let sandbox: SinonSandbox;
let DEFAULT_SUFFIX: string;
let MockFs: MockFs = {} as any;
let expect: any;
const DATA_DIR = path.resolve('some', 'dir', 'strongbox');
before(async function () {
const chai = await import('chai');
chai.should();
expect = chai.expect;
});
beforeEach(function () {
sandbox = createSandbox();
({strongbox, DEFAULT_SUFFIX, Strongbox} = rewiremock.proxy(
+3 -3
View File
@@ -5,8 +5,8 @@
"outDir": "build",
"strict": true,
"checkJs": true,
"types": ["node", "mocha", "chai", "chai-as-promised"]
"types": ["node", "chai", "chai-as-promised"]
},
"include": ["lib", "test"],
"exclude": ["**/*.test-d.ts"]
"include": ["lib", "test/unit", "test/e2e"],
"exclude": ["build"]
}