prometheusresearch-archive / webtest

Webtest is an opinionated Webpack based test runner.
MIT License
7 stars 0 forks source link

ignore node_modules #2

Closed bsr203 closed 7 years ago

bsr203 commented 9 years ago

I am not sure why it is complaining about tests in node_modules. In my webpack config, I disabled recursive lookup, and still getting this error. ALso, why All tests disabled, and not seeing any of my tests?

 webtest: {
    entry: [
      './lib/__tests__/*-test.js'
      //'./lib/**/__tests__/*-test.js'
    ]
  },
./node_modules/.bin/webtest .

WARNING in ./~/React/react.js
There is another module with an equal name when case is ignored.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Rename module if multiple modules are expected or use equal casing if one module is expected.
...

ERROR in ./~/reactify/~/react-tools/src/addons/link/__tests__/ReactLinkPropTypes-test.js
Module not found: Error: Cannot resolve module 'emptyFunction' in /Users/bsr/.... /react-tools/src/addons/link/__tests__
 @ ./~/reactify/~/react-tools/src/addons/link/__tests__/ReactLinkPropTypes-test.js 14:20-44

# starting
TAP version 13
1..0 # All tests disabled
#0 specs, 0 failures, 0 skipped, 0 disabled
andreypopp commented 9 years ago

Run it like this

webtest

If you supply it arguments it will treat it like entry and will try to discover test in there (appending discovery glob pattern if arg is a dir). The rule is arguments always override config.

Node modules still should be filtered, you are right.

On Thu, May 21, 2015, 21:49 bsr203 notifications@github.com wrote:

I am not sure why it is complaining about tests in node_modules. In my webpack config, I disabled recursive lookup, and still getting this error.

webtest: { entry: [ './lib/tests/_-test.js' //'./lib/_/tests/-test.js' ] },

./node_modules/.bin/webtest .

WARNING in ./~/React/react.js There is another module with an equal name when case is ignored. This can lead to unexpected behavior when compiling on a filesystem with other case-semantic. Rename module if multiple modules are expected or use equal casing if one module is expected. ...

ERROR in ./~/reactify/~/react-tools/src/addons/link/tests/ReactLinkPropTypes-test.js Module not found: Error: Cannot resolve module 'emptyFunction' in /Users/bsr/.... /react-tools/src/addons/link/tests @ ./~/reactify/~/react-tools/src/addons/link/tests/ReactLinkPropTypes-test.js 14:20-44

starting

TAP version 13 1..0 # All tests disabled

0 specs, 0 failures, 0 skipped, 0 disabled

— Reply to this email directly or view it on GitHub https://github.com/prometheusresearch/webtest/issues/2.

bsr203 commented 9 years ago

As you see, I am trying to use it against your react-forms package :-). I put log statement, to see the config, as

/**
 * Entry points discovery
 */

var entry = args.entry || [];

if (entry.length === 0) {
 console.log('======= webpack config =======', config)
 if (config && config.webtest && config.webtest.entry) {
    entry = config.webtest.entry;
  } else {
    entry = [context];
  }

   console.log('======= entry =======', entry)

}
./node_modules/.bin/webtest
======= webpack config ======= { module: { noParse: [ /\/sinon.js/ ], loaders: [ [Object], [Object] ] },
  webtest: { entry: [ './lib/__tests__/*-test.js' ] },
  resolve: { extensions: [ '', '.js', '.json', '.coffee' ] },
  plugins: 
   [ { resourceRegExp: /^sinon$/,
       newResource: '/Users/bsr/Work/Programming/web/react/repo/react-forms/vendor/sinon.js' } ] }
======= entry ======= [ './lib/__tests__/*-test.js' ]
[BABEL] Note: The code generator has deoptimised the styling of "/Users/bsr/Work/Programming/web/react/repo/react-forms/vendor/sinon.js" as it exceeds the max of "100KB".
phantom stdout: Incompatibile SockJS! Main site uses: "0.3.1.7.ga67f.dirty", the iframe: "0.3.4".
Incompatibile SockJS! Main site uses: "0.3.1.7.ga67f.dirty", the iframe: "0.3.4".

# starting
TAP version 13
1..0 # All tests disabled
# 0 specs, 0 failures, 0 skipped, 0 disabled
bsr[~/Work/Programming/web/react/repo/react-forms] [master] $ ls ./lib/__tests__/*-test.js
./lib/__tests__/Checkbox-test.js          ./lib/__tests__/Fieldset-test.js          ./lib/__tests__/RepeatingFieldset-test.js
./lib/__tests__/CheckboxGroup-test.js     ./lib/__tests__/Form-test.js              ./lib/__tests__/Value-test.js
./lib/__tests__/Element-test.js           ./lib/__tests__/Input-test.js             ./lib/__tests__/index-test.js
./lib/__tests__/Field-test.js             ./lib/__tests__/RadioButtonGroup-test.js
bsr[~/Work/Programming/web/react/repo/react-forms] [master] $ 
bsr203 commented 9 years ago
./node_modules/.bin/webtest lib/__tests__/*.js
[BABEL] Note: The code generator has deoptimised the styling of "/Users/bsr/Work/Programming/web/react/repo/react-forms/vendor/sinon.js" as it exceeds the max of "100KB".
# starting
TAP version 13
1..0 # All tests disabled
# 0 specs, 0 failures, 0 skipped, 0 disabled

ls  lib/__tests__/*.js
lib/__tests__/Checkbox-test.js          lib/__tests__/Fieldset-test.js          lib/__tests__/RepeatingFieldset-test.js
lib/__tests__/CheckboxGroup-test.js     lib/__tests__/Form-test.js              lib/__tests__/Value-test.js
lib/__tests__/Element-test.js           lib/__tests__/Input-test.js             lib/__tests__/index-test.js
lib/__tests__/Field-test.js             lib/__tests__/RadioButtonGroup-test.js
bsr203 commented 9 years ago

It finds the test, if I mention the file directly, but I guess issue with formatting the stack message

 ./node_modules/.bin/webtest ./lib/__tests__/Field-test.js 
[BABEL] Note: The code generator has deoptimised the styling of "/Users/bsr/Work/Programming/web/react/repo/react-forms/vendor/sinon.js" as it exceeds the max of "100KB".
# starting
TAP version 13
1..0 # All tests disabled
# 0 specs, 0 failures, 0 skipped, 0 disabled
stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
TypeError: Cannot read property 'slice' of null
    at StackMapper.proto._mapStack (/Users/bsr/Work/Programming/web/react/repo/react-forms/node_modules/webtest/node_modules/stack-mapper/index.js:70:22)
    at StackMapper.proto.map (/Users/bsr/Work/Programming/web/react/repo/react-forms/node_modules/webtest/node_modules/stack-mapper/index.js:100:8)
    at formatStackTrace (/Users/bsr/Work/Programming/web/react/repo/react-forms/node_modules/webtest/lib/formatStackTrace.js:93:55)
    at /Users/bsr/Work/Programming/web/react/repo/react-forms/node_modules/webtest/lib/phantomjs.js:86:63
andreypopp commented 9 years ago

You can turn on debug logging with the following command:

DEBUG='webtest:*' ./node_modules/.bin/webtest

Also regarding react-forms, its tests are written with mocha and not jasmine. webtest currently supports jasmine only though other test frameworks are easy to add.

bsr203 commented 9 years ago

that explain why it may not see the tests. but not sure the stack error after. thanks again for your help.

as a side note, do you plan to maintain react-forms, as it has some minor issue working with 0.13.x.

thanks again for all the great packages you deliver.

 DEBUG='webtest:*' ./node_modules/.bin/webtest
  webtest:index context: /Users/bsr/Work/Programming/web/react/repo/react-forms +0ms
  webtest:index entry points: ./lib/__tests__/*-test.js +3ms
  webtest:index entry points: /Users/bsr/Work/Programming/web/react/repo/react-forms/lib/__tests__/Checkbox-test.js,/Users/bsr/Work/Programming/web/react/repo/react-forms/lib/__tests__/CheckboxGroup-test.js,/Users/bsr/Work/Programming/web/react/repo/react-forms/lib/__tests__/Element-test.js,/Users/bsr/Work/Programming/web/react/repo/react-forms/lib/__tests__/Field-test.js,/Users/bsr/Work/Programming/web/react/repo/react-forms/lib/__tests__/Fieldset-test.js,/Users/bsr/Work/Programming/web/react/repo/react-forms/lib/__tests__/Form-test.js,/Users/bsr/Work/Programming/web/react/repo/react-forms/lib/__tests__/index-test.js,/Users/bsr/Work/Programming/web/react/repo/react-forms/lib/__tests__/Input-test.js,/Users/bsr/Work/Programming/web/react/repo/react-forms/lib/__tests__/RadioButtonGroup-test.js,/Users/bsr/Work/Programming/web/react/repo/react-forms/lib/__tests__/RepeatingFieldset-test.js,/Users/bsr/Work/Programming/web/react/repo/react-forms/lib/__tests__/Value-test.js +19ms
  webtest:compiler:test compile +61ms
  webtest:framework:jasmine using pre-built framework bundle +29ms
  webtest:index server started on port: 3000 +8ms
  webtest:phantomjs start running tests +5s
[BABEL] Note: The code generator has deoptimised the styling of "/Users/bsr/Work/Programming/web/react/repo/react-forms/vendor/sinon.js" as it exceeds the max of "100KB".
  webtest:compiler:test done +10s
# starting
TAP version 13
1..0 # All tests disabled
# 0 specs, 0 failures, 0 skipped, 0 disabled
stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
TypeError: Cannot read property 'slice' of null
    at StackMapper.proto._mapStack (/Users/bsr/Work/Programming/web/react/repo/react-forms/node_modules/webtest/node_modules/stack-mapper/index.js:70:22)
    at StackMapper.proto.map (/Users/bsr/Work/Programming/web/react/repo/react-forms/node_modules/webtest/node_modules/stack-mapper/index.js:100:8)
    at formatStackTrace (/Users/bsr/Work/Programming/web/react/repo/react-forms/node_modules/webtest/lib/formatStackTrace.js:93:55)
    at /Users/bsr/Work/Programming/web/react/repo/react-forms/node_modules/webtest/lib/phantomjs.js:86:63
andreypopp commented 9 years ago

Hm.. it actually runs tests react-forms for me (some even succeed)... will take a closer look.

Regarding react-forms, we plan to push a new version soon out of internal usage. API will change though.

bsr203 commented 9 years ago

well, I made some changes (as in the open pull requests) to make it work with 0.13.3. Not sure anything to do with it. Can't wait to see the new version. thnx.

I may leave it open if you like to track the stack issue, or please free to close this as it is not the intended usage.

andreypopp commented 9 years ago

I'll keep it open for now, thank you!

bsr203 commented 7 years ago

recently using jest exclusively. so don't need this anymore.