Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #5259
Closed
Open
Issue created Oct 03, 2018 by Administrator@rootContributor

Unknown option: base.configFile error when running tests

Created by: davidlukerice

Note from Maintainers

This is reportedly an issue with npm, as you will find below.

Please install Yarn as it's reportedly correctly hoisting packages, preventing this error.

If you'd like to continue using npm, run npm ls babel-core and remove offending packages that are relying on 6.x. Additionally, file a bug report with npm.


Is this a bug report?

Yes

Did you try recovering your dependencies?

Yes npm --version 6.4.1

Which terms did you search for in User Guide?

jest, test, babel, Unknown option: base.configFile

Environment

Environment: OS: macOS 10.14 Node: 8.10.0 Yarn: 1.6.0 npm: 6.4.1 Watchman: 4.9.0 Xcode: Xcode 10.0 Build version 10A255 Android Studio: Not Found

Packages: (wanted => installed) react: ^16.4.2 => 16.5.2 react-dom: ^16.4.2 => 16.5.2 react-scripts: 2.0.3 => 2.0.3

Steps to Reproduce

  1. Migrate from create-react-app v1.1.5 following the guide at https://github.com/facebook/create-react-app/releases
  2. Run the dev server and verify the app works correctly (npm start)
  3. Run all tests with npm test followed by a

Expected Behavior

Tests should run and complete

Actual Behavior

I get the following error on every test

Test suite failed to run

    ReferenceError: [BABEL] {redacted}/src/setupTests.js: Unknown option: base.configFile. Check out http://babeljs.io/docs/usage/options/ for more information about options.

    A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:

    Invalid:
      `{ presets: [{option: value}] }`
    Valid:
      `{ presets: [['presetName', {option: value}]] }`

    For more detailed information on preset configuration, please see https://babeljs.io/docs/en/plugins#pluginpresets-options.

      at Logger.error (node_modules/babel-core/lib/transformation/file/logger.js:41:11)
      at OptionManager.mergeOptions (node_modules/babel-core/lib/transformation/file/options/option-manager.js:226:20)
      at OptionManager.init (node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
      at File.initOptions (node_modules/babel-core/lib/transformation/file/index.js:212:65)
      at new File (node_modules/babel-core/lib/transformation/file/index.js:135:24)
      at Pipeline.transform (node_modules/babel-core/lib/transformation/pipeline.js:46:16)

my setupTests.js file contains the following

import 'react-testing-library/cleanup-after-each';
import 'jest-dom/extend-expect';

Adding them to a fresh app doesn't cause an issue.

Reproducible Demo

This is an internal project, but I'll work to see if I can narrow it down at all and reproduce in a fresh install. So far I haven't figured it out. I'm putting this issue up in the meantime to see if anyone else runs into it while migrating to v2. It also popped up at https://github.com/facebook/create-react-app/issues/5103#issuecomment-425722592, but clearing the node modules / lock / &c didn't help, nor did upgrading to node v10.

Assignee
Assign to
Time tracking