forked from react/create-react-app
-
Notifications
You must be signed in to change notification settings - Fork 31
[SEARCHEXP-1358]Handle relative path and resolve to their real path #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mungodewar
merged 7 commits into
Skyscanner:fork
from
gc-skyscanner:handle_relative_path
Jul 11, 2023
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7bddddf
handle relative path
gc-skyscanner 61cad51
remove console.log
gc-skyscanner 6701d9d
handle relative path
gc-skyscanner d5c10b7
unformat
gc-skyscanner 8e2809f
update version
gc-skyscanner 8203ec3
add unit test
gc-skyscanner 92c59e4
revert change log
gc-skyscanner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
| { | ||
| "env": { | ||
| "jest": true | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
12 changes: 9 additions & 3 deletions
12
packages/react-scripts/backpack-addons/babelIncludePrefixes.js
This file contains hidden or 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
26 changes: 26 additions & 0 deletions
26
packages/react-scripts/backpack-addons/babelIncludePrefixes.test.js
This file contains hidden or 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,26 @@ | ||
| 'use strict'; | ||
| const getBabelIncludePrefixes = require('../backpack-addons/babelIncludePrefixes'); | ||
|
|
||
| jest.mock('../config/paths', () => ({ | ||
| appSrc: '/Users/xxx/backpack-react-scripts/client/src', | ||
| appPackageJson: './test/mockPackage.json', | ||
| appPath: '/Users/xxx/backpack-react-scripts/client', | ||
| })); | ||
|
|
||
| describe('babelIncludePrefixes', () => { | ||
| test('should handler babelIncludePrefixes correctly', () => { | ||
| const babelIncludePrefixes = getBabelIncludePrefixes(); | ||
|
|
||
| expect(babelIncludePrefixes).toEqual([ | ||
| '/Users/xxx/backpack-react-scripts/client/src', | ||
| /node_modules[\\/]bpk-/, | ||
| /node_modules[\\/]saddlebag-/, | ||
| /node_modules[\\/]@skyscanner[\\/]bpk-/, | ||
| /node_modules[\\/]@skyscanner[\\/]backpack-web/, | ||
| new RegExp('node_modules[\\/]@skyscanner'), | ||
| '/Users/xxx/backpack-react-scripts/client/common', | ||
| '/Users/xxx/backpack-react-scripts/common', | ||
| '/server', | ||
| ]); | ||
| }); | ||
| }); |
This file contains hidden or 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,7 @@ | ||
| { | ||
| "name": "test", | ||
| "version": "1.0.0", | ||
| "backpack-react-scripts": { | ||
| "babelIncludePrefixes": ["@skyscanner", "./common", "../common", "/server"] | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we able to add unit tests for this at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be a good idea, added.
but seems BRS is lacking unit tests and there is no process in the pipeline to run the unit test automatically(I couldn’t find it if I don’t miss something), in this case, seems adding unit tests for this change doesn’t make much sense. Seems the test facility in BRS is not fully equipped, what do you think 🤔️