Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support mocha-parallel-tests #3

Open
stevefan1999-personal opened this issue Jan 28, 2019 · 5 comments
Open

Support mocha-parallel-tests #3

stevefan1999-personal opened this issue Jan 28, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@stevefan1999-personal
Copy link

If we are able to use https://github.com/mocha-parallel/mocha-parallel-tests, this could greatly benefit the test speed.

@larixer larixer added the enhancement New feature or request label Jan 28, 2019
@larixer
Copy link
Member

larixer commented Jan 29, 2019

This is doable, but it is certainly far from being easy, it is pretty hard. mocha-parallel-tests approach won't work here, because it doesn't deal with potentially slow webpack compilation process. The best way to implement it, IMHO, is to have one master process that runs webpack and many worker processes that will receive from master process compiled tests, each time compilation happens. Worker process will then run the received compiled tests from in-memory filesystem. Node Cluster API should be used for implementation:
https://nodejs.org/api/cluster.html

@ztalbot2000
Copy link

Hmm, I tried the obvious but that did not work.
Warning Passing multiple configs as an Array is not really supported. Only the first element will be parsed
WEBPACK Compiling...

[=========================] 100% (completed)

WEBPACK Failed to compile with 4 error(s)

Error in ./app/XXXXX/XXX.ts

Module parse failed: Unexpected token (15:10)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| {
| //O public var location:Number;

public location: number;

@ztalbot2000
Copy link

since I joined the config files I could not test it. my mistake, this quick fix does resolve my issue as a temp fix. ill send you my changes later

@ztalbot2000
Copy link

The reason why the patch works by only returning webpack.config.js, Configuration[0] is that webpack compiles the source, handling the multiple array; mochapack is passed the paths to the compiled code and or either array elements can compile the code, just the final bundle is different. so in this case, it works for me and the patch is backward compatible.

cat requireWebpackConfig.js.patch
--- src/cli/requireWebpackConfig.js 2019-12-08 19:14:05.000000000 -0500
+++ src/cli/requireWebpackConfig.js.new 2019-12-08 19:12:45.000000000 -0500
@@ -106,12 +106,14 @@
config = await Promise.resolve(config(env));
}

  • if (mode != null) {
  • config.mode = mode;
  • if (Array.isArray(config)) {
  • console.log("\x1b[35m Warning \x1b[30m" + 'Passing multiple webpack.configs as an Array is not fully supported.  Only the first element will be parsed');
    
  • config = config.shift();
    
    }
  • if (Array.isArray(config)) {
  • throw new Error('Passing multiple configs as an Array is not supported. Please provide a single config instead.');
  • if (mode != null) {
  • config.mode = mode;
    }

return config;

This may all that be needed for some people like myself as like you said, creating multiple child tasks with a task manager is much more complex.

thanks,
John Talbot

@leegee
Copy link

leegee commented Feb 25, 2020

Lack of this feature is why imma begrudgingly move to Jest..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants