Giter Site home page Giter Site logo

Comments (15)

zinserjan avatar zinserjan commented on August 18, 2024

@serut Does this problem only occur in watch or even in "single-run" mode?

My expectation is, that it happens also without watch.

from mocha-webpack.

serut avatar serut commented on August 18, 2024

I still don't get it @zinserjan

Not watching

mocha-webpack --webpack-config webpack.test.config.js "@(tests|web_modules)/**/*.test.js{,x}" --recursive
  2 passing (52ms)
mocha-webpack --webpack-config webpack.test.config.js "**/@(tests|web_modules)/**/*.test.js{,x}" --recursive
  149 passing (730ms)
  4 pending

Watching

mocha-webpack --timeout 5000 --webpack-config webpack.test.config.js "**/{tests,web_modules}/**/*.test.js{,x}" --recursive --watch
  2 passing (4s)
  0 passing (2ms)
mocha-webpack --timeout 5000 --webpack-config webpack.test.config.js "**/@(tests|web_modules)/**/*.test.js{,x}" --recursive --watch
  2 passing (4s)
  0 passing (3ms)
mocha-webpack --timeout 5000 --webpack-config webpack.test.config.js "web_modules/**/*.test.js{,x}" --recursive --require source-map-support/register --inline-diffs --watch --reporter nyan
  147 passing (2s)
  4 pending
mocha-webpack --timeout 5000 --webpack-config webpack.test.config.js "**/web_modules/**/*.test.js{,x}" --recursive --watch

  0 passing (2ms)
  0 passing (1ms)

from mocha-webpack.

zinserjan avatar zinserjan commented on August 18, 2024

Thanks. The glob matching algorithm is the same for both. The only difference is that the watch mode use also another plugin to detect which tests needs to run. Seems that there is bug in this plugin.

A few days ago I have been started to do a complete rewrite. Watch mode is now identical to the single run mode. I would appreciate it if you can test this again against the current master.

Here are some instructions to get this working:

  1. delete mocha-webpack from node_modules (no uninstall to keep files in .bin folder intact)
  2. git clone into node_modules
  3. cd mocha-webpack
  4. npm install
  5. npm run build
  6. run your tests again

from mocha-webpack.

serut avatar serut commented on August 18, 2024

Thanks it works great !!

mocha-webpack --timeout 5000 --webpack-config webpack.test.config.js "**/@(tests|web_modules)/**/*.test.js{,x}" --recursive --watch
  159 passing (2s)
  4 pending
mocha-webpack --timeout 5000 --webpack-config webpack.test.config.js "**/{tests,web_modules}/**/*.test.js{,x}" --recursive --watch
  159 passing (3s)
  4 pending

from mocha-webpack.

zinserjan avatar zinserjan commented on August 18, 2024

Yay! Sounds great. I'll try to complete the remaining coding tasks for 1.0.0 in the next days and make a prerelease.

Can you also test the in-memory branch from #83 with your test suite?

from mocha-webpack.

serut avatar serut commented on August 18, 2024

How can I test thein-memory improvement ? Just in terms of speed ?

from mocha-webpack.

serut avatar serut commented on August 18, 2024
git fetch in-memory
git checkout in-memory
npm run test:mocha
  159 passing (358ms)
  4 pending

from mocha-webpack.

zinserjan avatar zinserjan commented on August 18, 2024

How can I test the in-memory improvement ?

Test should run and no files are written to .tmp. That's all :)

Just in terms of speed ?

Theoretically yes, but I didn't notice any speed improvements so far.

from mocha-webpack.

zinserjan avatar zinserjan commented on August 18, 2024

Did you run npm install & npm run build again?

from mocha-webpack.

serut avatar serut commented on August 18, 2024

Nop. Good catch (.tmp was recreated)

from mocha-webpack.

serut avatar serut commented on August 18, 2024

I don't have the .tmp folder but I have two new error that I didn't had previously.

157 passing (580ms)
  4 pending
  2 failing

  1) [COMMON] Testing i18n actions Test actions creation for internationalization language change:
     Error: Cannot find module './1.bundle.js'
      at Function._resolveFilename (node_modules/mocha-webpack/lib/webpack/util/registerRequireHook.js:36:34)
      at require (internal/module.js:20:19)
      at Function.requireEnsure [as e] (.tmp/mocha-webpack/webpack/bootstrap e12f69137d35a6eb37ff:39:1)
[ my code]

  2) [COMMON] Testing i18n actions Test fallback en-US --> en:
     Error: Cannot find module './1.bundle.js'
      at Function._resolveFilename (node_modules/mocha-webpack/lib/webpack/util/registerRequireHook.js:36:34)
      at require (internal/module.js:20:19)
      at Function.requireEnsure [as e] (.tmp/mocha-webpack/webpack/bootstrap e12f69137d35a6eb37ff:39:1)
[ my code]

My code is a little bit suxx:

require.ensure([], (require) => {
      let messages
      try {
        // eslint-disable-next-line import/no-dynamic-require
        messages = require(`../../../../${messagesDir}/messages.${locale}.i18n.js`)
    }
})

It imports a js file dynamically...

I reswitched to master, npm install & npm run build, and my tests are fine

  159 passing (388ms)
  4 pending

from mocha-webpack.

zinserjan avatar zinserjan commented on August 18, 2024

Are you using code splitting like require.ensure?

from mocha-webpack.

serut avatar serut commented on August 18, 2024

Yes we use code splitting with require.ensure 35 times in our project.

33 on routing (worked great when I tested with in-memory) and 2 failed (you have the code in my previous comment)

from mocha-webpack.

zinserjan avatar zinserjan commented on August 18, 2024

So sometimes it works with require.ensure and sometimes not?

Anyway, can you create a minimal failing example? That would be so awesome and helps me alot :)

from mocha-webpack.

serut avatar serut commented on August 18, 2024

So sometimes it works with require.ensure and sometimes not?

It works when the path is static, like

require.ensure([], (require) => {
      const ProjectFormContainer = require('./containers/FormContainer')
      cb(null, {
        content: FormContainer.default,
      })
})

but not when it's computed.

from mocha-webpack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.