-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Regression (8.1.2): mocha/mocha.js is no longer bundle compatible (uses dynamic require) #4422
Closed
4 tasks done
Labels
semver-patch
implementation requires increase of "patch" version number; "bug fixes"
type: bug
a defect, confirmed by a maintainer
Comments
Looks like Here are the relevant pieces of code from the bundle. Seems webpack is breaking on the Mocha.unloadFile = function (file) {
delete require.cache[require.resolve(file)];
};
/**
* Unloads `files` from Node's `require` cache.
*
* @description
* This allows required files to be "freshly" reloaded, providing the ability
* to reuse a Mocha instance programmatically.
* Note: does not clear ESM module files from the cache
*
* <strong>Intended for consumers — not used internally</strong>
*
* @public
* @see {@link Mocha#run}
* @returns {Mocha} this
* @chainable
*/
Mocha.prototype.unloadFiles = function () {
if (this._state === mochaStates.DISPOSED) {
throw createMochaInstanceAlreadyDisposedError('Mocha instance is already disposed, it cannot be used again.', this._cleanReferencesAfterRun, this);
}
this.files.forEach(function (file) {
Mocha.unloadFile(file);
});
this._state = mochaStates.INIT;
return this;
}; |
Munter
added
type: bug
a defect, confirmed by a maintainer
semver-patch
implementation requires increase of "patch" version number; "bug fixes"
and removed
unconfirmed-bug
labels
Aug 26, 2020
This was referenced Aug 27, 2020
boneskull
added a commit
that referenced
this issue
Aug 27, 2020
Fix for this is in #4419 |
boneskull
added a commit
that referenced
this issue
Aug 27, 2020
boneskull
added a commit
that referenced
this issue
Aug 28, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
semver-patch
implementation requires increase of "patch" version number; "bug fixes"
type: bug
a defect, confirmed by a maintainer
Prerequisites
faq
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend that you not install Mocha globally.Description
Starting with v8.1.2,
mocha/mocha.js
contains node-specific code (dynamic require call) and is no longer bundle compatibleSteps to Reproduce
Expected behavior: [What you expect to happen]
No errors or warnings when trying to import and bundle
mocha/mocha.js
.Same as
8.1.1
.Actual behavior: [What actually happens]
Reproduces how often: [What percentage of the time does it reproduce?]
Consistently. 100% of the time.
Versions
Additional Information
This issue breaks
mocha-loader
andmocha-pup
.The text was updated successfully, but these errors were encountered: