Skip to content

test: fix duplicate test name and migrate mocha.opts to .mocharc.json#39

Open
tedteddy wants to merge 1 commit intoomni-door:masterfrom
tedteddy:test/fix-and-modernize
Open

test: fix duplicate test name and migrate mocha.opts to .mocharc.json#39
tedteddy wants to merge 1 commit intoomni-door:masterfrom
tedteddy:test/fix-and-modernize

Conversation

@tedteddy
Copy link
Copy Markdown
Member

Summary

This PR fixes a test naming bug and modernizes the Mocha configuration.

Changes

1. Fix duplicate test name (Bug Fix)

In src/commands/initial/__test__/index.test.ts, line 119 had a duplicate test name:

Before:

it('cli_entire_react checking', function () {  // Wrong name!
  expect(cli_entire_react).to.be.an('object');  // Wrong assertion!
  expect(cli_pc_react.build)...  // Actually testing cli_pc_react

After:

it('cli_pc_react checking', function () {  // Correct name
  expect(cli_pc_react).to.be.an('object');  // Correct assertion
  expect(cli_pc_react.build)...

2. Migrate mocha.opts to .mocharc.json

The mocha.opts file format has been deprecated since Mocha 6.0.0. This PR:

  • Creates .mocharc.json with the same configuration
  • Updates package.json test script to use the new config
  • Removes the deprecated mocha.opts file

New .mocharc.json:

{
  "require": ["ts-node/register"],
  "spec": "src/**/__test__/*.ts",
  "reporter": "spec",
  "timeout": 10000
}

Benefits

  • Fixes incorrect test case that was testing the wrong preset
  • Uses modern Mocha configuration format
  • Adds explicit timeout to prevent hanging tests
  • Better IDE support for JSON config files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant