zordius / gulp-jsx-coverage

deprecated
https://www.npmjs.com/package/gulp-jsx-coverage
Other
34 stars 10 forks source link

Allow for imports that don't include .jsx extension #31

Closed thetallweeks closed 8 years ago

thetallweeks commented 8 years ago

This is more of a question. I'm confident that I just can't find the right config options for this.

I want to be able to import files like: import SomeReactComponent from '../../SomeReactComponent'

without requiring the .jsx extension. E.g. '../../SomeReactComponent.jsx'

Right now, this is my gulp-jsx-coverage config:

{
    src: [
      'test/**/*+(.js|.jsx)',
      'src/**/*.js',
      'src/**/components/*.jsx'
    ],
    isparta: false,
    istanbul: {
      preserveComments: false,
      coverageVariable: '__MY_TEST_COVERAGE__',
      exclude: /node_modules|test/
    },

    transpile: {
      babel: {
        include: /\.jsx?$/,
        exclude: /node_modules/,
        omitExt: false
      }
    },

    coverage: {
      reporters: ['text-summary', 'json', 'lcov'],
      directory: 'coverage'
    },

    mocha: {
      reporter: 'spec'
    },

    babel: {
      plugins: ['transform-runtime']
    },

    //optional
    cleanup: function () {
      // do extra tasks after test done
      // EX: clean global.window when test with jsdom
    }
  }

I've done some research but haven't found what to add and where. Do you have an idea of what config option I need to add for this?

zordius commented 8 years ago

You can try to change the line omitExt: false into omitExt: ['.jsx']

thetallweeks commented 8 years ago

Works great! Thank you!