From 9bd06b42043708dec8c6778f14c316d56a564b27 Mon Sep 17 00:00:00 2001 From: Jason Ge <394356719@qq.com> Date: Tue, 20 Jan 2026 03:30:21 +0800 Subject: [PATCH] test: fix duplicate test name and migrate mocha.opts to .mocharc.json --- .mocharc.json | 6 ++++++ mocha.opts | 3 --- package.json | 2 +- src/commands/initial/__test__/index.test.ts | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 .mocharc.json delete mode 100644 mocha.opts diff --git a/.mocharc.json b/.mocharc.json new file mode 100644 index 0000000..e7a5d0b --- /dev/null +++ b/.mocharc.json @@ -0,0 +1,6 @@ +{ + "require": ["ts-node/register"], + "spec": "src/**/__test__/*.ts", + "reporter": "spec", + "timeout": 10000 +} diff --git a/mocha.opts b/mocha.opts deleted file mode 100644 index b40100d..0000000 --- a/mocha.opts +++ /dev/null @@ -1,3 +0,0 @@ -# mocha.opts - --require ts-node/register src/**/__test__/*.ts - --reporter spec \ No newline at end of file diff --git a/package.json b/package.json index c76c210..67fac2f 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "main": "lib/commands/commands.js", "typings": "lib/commands/commands.d.ts", "scripts": { - "test": "nyc mocha --opts mocha.opts", + "test": "nyc mocha", "lint": "eslint src/ --ext .ts --ext .tsx", "lint:fix": "eslint src/ --ext .ts --ext .tsx --fix", "build": "npm run build:rm && npm run build:tsc && npm run build:copy", diff --git a/src/commands/initial/__test__/index.test.ts b/src/commands/initial/__test__/index.test.ts index 0e2b3eb..1949c63 100644 --- a/src/commands/initial/__test__/index.test.ts +++ b/src/commands/initial/__test__/index.test.ts @@ -116,8 +116,8 @@ describe('initial preset test', function () { expect(cli_entire_react.stylelint).to.be.true; }); - it('cli_entire_react checking', function () { - expect(cli_entire_react).to.be.an('object'); + it('cli_pc_react checking', function () { + expect(cli_pc_react).to.be.an('object'); expect(cli_pc_react.build).to.be.a('string'); expect(cli_pc_react.build).to.be.equal('webpack');