Skip to content

Commit fe25cc3

Browse files
authored
Merge pull request #369 from fs-webdev/handleSplitIoJest
use browser-resolve for splitio imports in jest config
2 parents f017872 + 3566e18 commit fe25cc3

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed

CHANGELOG-FRONTIER.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 8.7.10
2+
3+
- Have jest configuration use browser-resolve for requires in splitio packages. Only affects jest tests, nothing else.
4+
15
## 8.7.9
26

37
- Add additional check for unsupported browser banner to avoid errors

package-lock.json

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-scripts/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fs/react-scripts",
3-
"version": "8.7.9",
3+
"version": "8.7.10",
44
"upstreamVersion": "5.0.1",
55
"description": "Configuration and scripts for Create React App.",
66
"repository": {
@@ -60,6 +60,7 @@
6060
"babel-plugin-bundled-import-meta": "^0.3.2",
6161
"babel-plugin-named-asset-import": "^0.3.8",
6262
"bfj": "^7.0.2",
63+
"browser-resolve": "^2.0.0",
6364
"browserslist": "^4.18.1",
6465
"camelcase": "^6.2.1",
6566
"case-sensitive-paths-webpack-plugin": "^2.4.0",

packages/react-scripts/scripts/utils/createJestConfig.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ module.exports = (resolve, rootDir, isEjecting) => {
2525

2626
const config = {
2727
roots: ['<rootDir>/src'],
28+
resolver: `${__dirname}/jestResolver.js`,
2829

2930
collectCoverageFrom:[
3031
"src/**/*.{js,jsx,ts,tsx}",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict'
2+
const browserResolve = require('browser-resolve')
3+
4+
module.exports = (path, options) => {
5+
if (options.basedir.includes('@splitsoftware/splitio')) {
6+
return browserResolve.sync(path, options)
7+
}
8+
return options.defaultResolver(path, options)
9+
}

0 commit comments

Comments
 (0)