Pass spec metadata to filters, not internal Spec instance
This commit is contained in:
@@ -1499,8 +1499,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
runQueue,
|
runQueue,
|
||||||
TreeProcessor: j$.TreeProcessor,
|
TreeProcessor: j$.TreeProcessor,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
getConfig: () => config,
|
getConfig: () => config
|
||||||
deprecated: this.deprecated
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setParallelLoadingState = function(state) {
|
this.setParallelLoadingState = function(state) {
|
||||||
@@ -9445,7 +9444,6 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
#globalErrors;
|
#globalErrors;
|
||||||
#reportDispatcher;
|
#reportDispatcher;
|
||||||
#getConfig;
|
#getConfig;
|
||||||
#deprecated;
|
|
||||||
#executedBefore;
|
#executedBefore;
|
||||||
#currentRunableTracker;
|
#currentRunableTracker;
|
||||||
|
|
||||||
@@ -9459,7 +9457,6 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
this.#globalErrors = options.globalErrors;
|
this.#globalErrors = options.globalErrors;
|
||||||
this.#reportDispatcher = options.reportDispatcher;
|
this.#reportDispatcher = options.reportDispatcher;
|
||||||
this.#getConfig = options.getConfig;
|
this.#getConfig = options.getConfig;
|
||||||
this.#deprecated = options.deprecated;
|
|
||||||
this.#executedBefore = false;
|
this.#executedBefore = false;
|
||||||
this.#currentRunableTracker = new j$.CurrentRunableTracker();
|
this.#currentRunableTracker = new j$.CurrentRunableTracker();
|
||||||
}
|
}
|
||||||
@@ -9512,9 +9509,8 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
orderChildren: function(node) {
|
orderChildren: function(node) {
|
||||||
return order.sort(node.children);
|
return order.sort(node.children);
|
||||||
},
|
},
|
||||||
excludeNode: spec => {
|
excludeNode: function(spec) {
|
||||||
const proxy = j$.deprecatingSpecProxy(spec, this.#deprecated);
|
return !config.specFilter(spec.metadata);
|
||||||
return !config.specFilter(proxy);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.#executionTree = treeProcessor.processTree();
|
this.#executionTree = treeProcessor.processTree();
|
||||||
|
|||||||
@@ -925,40 +925,6 @@ describe('Env integration', function() {
|
|||||||
expect(suiteCallback).toHaveBeenCalled();
|
expect(suiteCallback).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('reports a deprecation warning when a spec filter accesses private properties', async function() {
|
|
||||||
env.it('a spec', function() {});
|
|
||||||
|
|
||||||
const reporter = jasmine.createSpyObj('reporter', ['jasmineDone']);
|
|
||||||
env.addReporter(reporter);
|
|
||||||
|
|
||||||
env.configure({
|
|
||||||
random: false,
|
|
||||||
specFilter: function(spec) {
|
|
||||||
spec.result; // deprecated
|
|
||||||
spec.id; // not deprecated
|
|
||||||
spec.description; // not deprecated
|
|
||||||
spec.getPath(); // not deprecated
|
|
||||||
spec.getFullName(); // not deprecated
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
spyOn(console, 'error');
|
|
||||||
await env.execute();
|
|
||||||
|
|
||||||
expect(reporter.jasmineDone).toHaveBeenCalledWith(
|
|
||||||
jasmine.objectContaining({
|
|
||||||
deprecationWarnings: [
|
|
||||||
jasmine.objectContaining({
|
|
||||||
message: jasmine.stringContaining(
|
|
||||||
'Access to private Spec members (in this case `result`)'
|
|
||||||
)
|
|
||||||
})
|
|
||||||
]
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Functions can be spied on and have their calls tracked', async function() {
|
it('Functions can be spied on and have their calls tracked', async function() {
|
||||||
let originalFunctionWasCalled = false;
|
let originalFunctionWasCalled = false;
|
||||||
const subject = {
|
const subject = {
|
||||||
|
|||||||
@@ -371,8 +371,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
runQueue,
|
runQueue,
|
||||||
TreeProcessor: j$.TreeProcessor,
|
TreeProcessor: j$.TreeProcessor,
|
||||||
globalErrors,
|
globalErrors,
|
||||||
getConfig: () => config,
|
getConfig: () => config
|
||||||
deprecated: this.deprecated
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setParallelLoadingState = function(state) {
|
this.setParallelLoadingState = function(state) {
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
#globalErrors;
|
#globalErrors;
|
||||||
#reportDispatcher;
|
#reportDispatcher;
|
||||||
#getConfig;
|
#getConfig;
|
||||||
#deprecated;
|
|
||||||
#executedBefore;
|
#executedBefore;
|
||||||
#currentRunableTracker;
|
#currentRunableTracker;
|
||||||
|
|
||||||
@@ -24,7 +23,6 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
this.#globalErrors = options.globalErrors;
|
this.#globalErrors = options.globalErrors;
|
||||||
this.#reportDispatcher = options.reportDispatcher;
|
this.#reportDispatcher = options.reportDispatcher;
|
||||||
this.#getConfig = options.getConfig;
|
this.#getConfig = options.getConfig;
|
||||||
this.#deprecated = options.deprecated;
|
|
||||||
this.#executedBefore = false;
|
this.#executedBefore = false;
|
||||||
this.#currentRunableTracker = new j$.CurrentRunableTracker();
|
this.#currentRunableTracker = new j$.CurrentRunableTracker();
|
||||||
}
|
}
|
||||||
@@ -77,9 +75,8 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
orderChildren: function(node) {
|
orderChildren: function(node) {
|
||||||
return order.sort(node.children);
|
return order.sort(node.children);
|
||||||
},
|
},
|
||||||
excludeNode: spec => {
|
excludeNode: function(spec) {
|
||||||
const proxy = j$.deprecatingSpecProxy(spec, this.#deprecated);
|
return !config.specFilter(spec.metadata);
|
||||||
return !config.specFilter(proxy);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.#executionTree = treeProcessor.processTree();
|
this.#executionTree = treeProcessor.processTree();
|
||||||
|
|||||||
Reference in New Issue
Block a user