-
Notifications
You must be signed in to change notification settings - Fork 634
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
skip certain tests when installing yarn ignoring the lockfile
- Loading branch information
Showing
6 changed files
with
67 additions
and
1 deletion.
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
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,22 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
|
||
const ignoredTests = { | ||
// "path/ending-with/test-name.js": ["test name 1", "test name 2"] | ||
}; | ||
|
||
if (process.env.YARN_INSTALL_NO_LOCKFILE) { | ||
// flaky babel types test - this should be removed once babel is updated | ||
ignoredTests['__tests__/babel-lib-defs-test.js'] = [ | ||
'Babel Flow library definitions should be up to date', | ||
]; | ||
} | ||
|
||
module.exports = ignoredTests; |
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,31 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
|
||
import jestFilter from './jestFilter'; | ||
import callsites from 'callsites'; | ||
|
||
const origTest = test; | ||
global.test = (testName, ...args) => { | ||
const calledFromFile = callsites()[1].getFileName(); | ||
const shouldSkip = Object.entries(jestFilter).some( | ||
([ignoredFile, ignoredTestNames]) => { | ||
return ( | ||
calledFromFile.endsWith(ignoredFile) && | ||
ignoredTestNames.includes(testName) | ||
); | ||
}, | ||
); | ||
return (shouldSkip ? origTest.skip : origTest)(testName, ...args); | ||
}; | ||
Object.keys(origTest).forEach(propName => { | ||
global.test[propName] = origTest[propName]; | ||
}); | ||
global.test; | ||
global.it = test; |
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