mocha-parallel / mocha-parallel-tests

Parallel test runner for mocha tests. Looking for maintainer.
MIT License
199 stars 45 forks source link

feat: add --file option #267

Closed favna closed 4 years ago

favna commented 4 years ago

This will resolve #222

Merging this PR adds the Mocha option for --file to have a single global setup file - with the caveats that @1999 shared in the issue discussion.

1999 commented 4 years ago

Looks like the test fails in mocha@6

favna commented 4 years ago

@1999 I completely forgot about this pr in between all the other things. I just tried running the mocha 6 based tests locally (MacOS Catalina with Node v12) and they seem to run just fine (log here: https://hasteb.in/urumavot.yaml).

Gave Travis a bump in 554f5c9 with an empty commit to check it wasn't just flakyness

favna commented 4 years ago

There is indeed some kind of flakyness. Now it broke on Mocha v4.

FlyingPumba commented 4 years ago

@1999 @Favna I could use this feature as well to execute root level hooks for each test case (i.e., defining beforeEach and afterEach at the root level). Is there any workaround available in the meantime?

BTW, I tried downloading the fork as a github dependency on my project (using npm install --save-dev Favna/mocha-parallel-tests#feat/file_option) but it fails to build with errors:

npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /home/src/my_project/node_modules/mocha-parallel-tests/dist/bin/cli.js
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/home/src/my_project/node_modules/mocha-parallel-tests/dist/bin/cli.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

Am I doing something wrong? The same happens if I try to run: npm install --save-dev mocha-parallel/mocha-parallel-tests

favna commented 4 years ago

@FlyingPumba TypeScript written packages cannot really be installed from GitHub unless you manually go into node_modules/mocha-parallel-test and run npm run build. Since the main field in package.json will reference the compiled JS, but the source code (from GitHub) only has the source TypeScript files.

FlyingPumba commented 4 years ago

@Favna That makes sense, thanks. I will try to set it up locally.

1999 commented 4 years ago

@Favna I wouldn't say it's flaky - the tests always fail on the newly added "file" test case. Sorry, I don't have enough time to look into this project now.

1999 commented 4 years ago

I will fix it on my own.

favna commented 4 years ago

@1999 tyvm

1999 commented 4 years ago

https://github.com/mocha-parallel/mocha-parallel-tests/pull/277