-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filter API pre-filter setup hook. (#8142)
* Filter API pre-filter setup hook. * Ensure filter API setup Promise resolves before filtering. * Pass through wrapped filter to avoid including it twice. * Resolve lint error. * Fix unit test for Node v6. * Update changelog. * Add tests and improve behavior for errors in filter and setup filter. * Resolve lint error. * Update CHANGELOG.md * Fix broken filter test in Node 6.
- Loading branch information
1 parent
d6af3af
commit 4a57c24
Showing
10 changed files
with
154 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
|
||
'use strict'; | ||
|
||
module.exports = function(tests) { | ||
return new Promise((resolve, reject) => { | ||
reject(new Error('My broken filter error.')); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
|
||
'use strict'; | ||
|
||
module.exports = function(tests) { | ||
return { | ||
filtered: tests.filter(t => t.indexOf('foo') !== -1).map(test => ({test})), | ||
}; | ||
}; | ||
|
||
module.exports.setup = function() { | ||
return new Promise((resolve, reject) => { | ||
setTimeout(() => { | ||
reject(new Error('My broken setup filter error.')); | ||
}, 0); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
|
||
'use strict'; | ||
|
||
const setupData = { | ||
filterText: 'this will return no tests', | ||
}; | ||
|
||
module.exports = function(tests) { | ||
return { | ||
filtered: tests | ||
.filter(t => t.indexOf(setupData.filterText) !== -1) | ||
.map(test => ({test})), | ||
}; | ||
}; | ||
|
||
module.exports.setup = function() { | ||
return new Promise(resolve => { | ||
setTimeout(() => { | ||
setupData.filterText = 'foo'; | ||
resolve(); | ||
}, 1000); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters