Pass spec metadata to filters, not internal Spec instance
This commit is contained in:
@@ -1499,8 +1499,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
runQueue,
|
||||
TreeProcessor: j$.TreeProcessor,
|
||||
globalErrors,
|
||||
getConfig: () => config,
|
||||
deprecated: this.deprecated
|
||||
getConfig: () => config
|
||||
});
|
||||
|
||||
this.setParallelLoadingState = function(state) {
|
||||
@@ -9445,7 +9444,6 @@ getJasmineRequireObj().Runner = function(j$) {
|
||||
#globalErrors;
|
||||
#reportDispatcher;
|
||||
#getConfig;
|
||||
#deprecated;
|
||||
#executedBefore;
|
||||
#currentRunableTracker;
|
||||
|
||||
@@ -9459,7 +9457,6 @@ getJasmineRequireObj().Runner = function(j$) {
|
||||
this.#globalErrors = options.globalErrors;
|
||||
this.#reportDispatcher = options.reportDispatcher;
|
||||
this.#getConfig = options.getConfig;
|
||||
this.#deprecated = options.deprecated;
|
||||
this.#executedBefore = false;
|
||||
this.#currentRunableTracker = new j$.CurrentRunableTracker();
|
||||
}
|
||||
@@ -9512,9 +9509,8 @@ getJasmineRequireObj().Runner = function(j$) {
|
||||
orderChildren: function(node) {
|
||||
return order.sort(node.children);
|
||||
},
|
||||
excludeNode: spec => {
|
||||
const proxy = j$.deprecatingSpecProxy(spec, this.#deprecated);
|
||||
return !config.specFilter(proxy);
|
||||
excludeNode: function(spec) {
|
||||
return !config.specFilter(spec.metadata);
|
||||
}
|
||||
});
|
||||
this.#executionTree = treeProcessor.processTree();
|
||||
|
||||
@@ -925,40 +925,6 @@ describe('Env integration', function() {
|
||||
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() {
|
||||
let originalFunctionWasCalled = false;
|
||||
const subject = {
|
||||
|
||||
@@ -371,8 +371,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
runQueue,
|
||||
TreeProcessor: j$.TreeProcessor,
|
||||
globalErrors,
|
||||
getConfig: () => config,
|
||||
deprecated: this.deprecated
|
||||
getConfig: () => config
|
||||
});
|
||||
|
||||
this.setParallelLoadingState = function(state) {
|
||||
|
||||
@@ -10,7 +10,6 @@ getJasmineRequireObj().Runner = function(j$) {
|
||||
#globalErrors;
|
||||
#reportDispatcher;
|
||||
#getConfig;
|
||||
#deprecated;
|
||||
#executedBefore;
|
||||
#currentRunableTracker;
|
||||
|
||||
@@ -24,7 +23,6 @@ getJasmineRequireObj().Runner = function(j$) {
|
||||
this.#globalErrors = options.globalErrors;
|
||||
this.#reportDispatcher = options.reportDispatcher;
|
||||
this.#getConfig = options.getConfig;
|
||||
this.#deprecated = options.deprecated;
|
||||
this.#executedBefore = false;
|
||||
this.#currentRunableTracker = new j$.CurrentRunableTracker();
|
||||
}
|
||||
@@ -77,9 +75,8 @@ getJasmineRequireObj().Runner = function(j$) {
|
||||
orderChildren: function(node) {
|
||||
return order.sort(node.children);
|
||||
},
|
||||
excludeNode: spec => {
|
||||
const proxy = j$.deprecatingSpecProxy(spec, this.#deprecated);
|
||||
return !config.specFilter(proxy);
|
||||
excludeNode: function(spec) {
|
||||
return !config.specFilter(spec.metadata);
|
||||
}
|
||||
});
|
||||
this.#executionTree = treeProcessor.processTree();
|
||||
|
||||
Reference in New Issue
Block a user