Warn if jasmine-core is loaded as an ES module in browsers
This commit is contained in:
@@ -118,6 +118,9 @@ var getJasmineRequireObj = (function() {
|
|||||||
j$.private.matchers = jRequire.requireMatchers(jRequire, j$);
|
j$.private.matchers = jRequire.requireMatchers(jRequire, j$);
|
||||||
j$.private.asyncMatchers = jRequire.requireAsyncMatchers(jRequire, j$);
|
j$.private.asyncMatchers = jRequire.requireAsyncMatchers(jRequire, j$);
|
||||||
|
|
||||||
|
j$.private.loadedAsBrowserEsm =
|
||||||
|
globalThis.document && !globalThis.document.currentScript;
|
||||||
|
|
||||||
return j$;
|
return j$;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1594,6 +1597,14 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
this.execute = async function(runablesToRun) {
|
this.execute = async function(runablesToRun) {
|
||||||
installGlobalErrors();
|
installGlobalErrors();
|
||||||
|
|
||||||
|
// Karma incorrectly loads jasmine-core as an ES module. It isn't one,
|
||||||
|
// and we don't test that configuration. Warn about it.
|
||||||
|
if (j$.private.loadedAsBrowserEsm) {
|
||||||
|
this.deprecated(
|
||||||
|
"jasmine-core isn't an ES module but it was loaded as one. This is not a supported configuration."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (parallelLoadingState) {
|
if (parallelLoadingState) {
|
||||||
validateConfigForParallel();
|
validateConfigForParallel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -402,6 +402,14 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
this.execute = async function(runablesToRun) {
|
this.execute = async function(runablesToRun) {
|
||||||
installGlobalErrors();
|
installGlobalErrors();
|
||||||
|
|
||||||
|
// Karma incorrectly loads jasmine-core as an ES module. It isn't one,
|
||||||
|
// and we don't test that configuration. Warn about it.
|
||||||
|
if (j$.private.loadedAsBrowserEsm) {
|
||||||
|
this.deprecated(
|
||||||
|
"jasmine-core isn't an ES module but it was loaded as one. This is not a supported configuration."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (parallelLoadingState) {
|
if (parallelLoadingState) {
|
||||||
validateConfigForParallel();
|
validateConfigForParallel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,6 +94,9 @@ var getJasmineRequireObj = (function() {
|
|||||||
j$.private.matchers = jRequire.requireMatchers(jRequire, j$);
|
j$.private.matchers = jRequire.requireMatchers(jRequire, j$);
|
||||||
j$.private.asyncMatchers = jRequire.requireAsyncMatchers(jRequire, j$);
|
j$.private.asyncMatchers = jRequire.requireAsyncMatchers(jRequire, j$);
|
||||||
|
|
||||||
|
j$.private.loadedAsBrowserEsm =
|
||||||
|
globalThis.document && !globalThis.document.currentScript;
|
||||||
|
|
||||||
return j$;
|
return j$;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user