-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix packager asset requests on windows
Summary: 6554ad5 broke assets on windows, this fixes it and add a test to avoid regressions. Ideally we'd run all the Dependency graph tests on both posix and win32 filesystems but that would probably require doing some sort of factory function to create the tests because I don't think we want to duplicate every test (file is big enough already :)). So for now I just copied that one test and changed the paths manually. **Test plan** Run the new test without the fix -> fails Run the new test with the fix -> succeeds Closes #11254 Differential Revision: D4265157 Pulled By: cpojer fbshipit-source-id: 511470276bd950c2943e94c2dce6840df0fe6d69
- Loading branch information
1 parent
ca403f0
commit d77b4fd
Showing
2 changed files
with
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2562,6 +2562,81 @@ describe('DependencyGraph', function() { | |
]); | ||
}); | ||
}); | ||
|
||
it('should get dependencies with assets and resolution', function() { | ||
const root = 'C:\\root'; | ||
setMockFileSystem({ | ||
'root': { | ||
'index.js': [ | ||
'/**', | ||
' * @providesModule index', | ||
' */', | ||
'require("./imgs/a.png");', | ||
'require("./imgs/b.png");', | ||
'require("./imgs/c.png");', | ||
].join('\n'), | ||
'imgs': { | ||
'[email protected]': '', | ||
'[email protected]': '', | ||
'c.png': '', | ||
'[email protected]': '', | ||
}, | ||
'package.json': JSON.stringify({ | ||
name: 'rootPackage', | ||
}), | ||
}, | ||
}); | ||
|
||
var dgraph = new DependencyGraph({ | ||
...defaults, | ||
roots: [root], | ||
}); | ||
return getOrderedDependenciesAsJSON(dgraph, 'C:\\root\\index.js').then(function(deps) { | ||
expect(deps) | ||
.toEqual([ | ||
{ | ||
id: 'index', | ||
path: 'C:\\root\\index.js', | ||
dependencies: [ | ||
'./imgs/a.png', | ||
'./imgs/b.png', | ||
'./imgs/c.png', | ||
], | ||
isAsset: false, | ||
isJSON: false, | ||
isPolyfill: false, | ||
resolution: undefined, | ||
}, | ||
{ | ||
id: 'rootPackage/imgs/a.png', | ||
path: 'C:\\root\\imgs\\[email protected]', | ||
resolution: 1.5, | ||
dependencies: [], | ||
isAsset: true, | ||
isJSON: false, | ||
isPolyfill: false, | ||
}, | ||
{ | ||
id: 'rootPackage/imgs/b.png', | ||
path: 'C:\\root\\imgs\\[email protected]', | ||
resolution: 0.7, | ||
dependencies: [], | ||
isAsset: true, | ||
isJSON: false, | ||
isPolyfill: false, | ||
}, | ||
{ | ||
id: 'rootPackage/imgs/c.png', | ||
path: 'C:\\root\\imgs\\c.png', | ||
resolution: 1, | ||
dependencies: [], | ||
isAsset: true, | ||
isJSON: false, | ||
isPolyfill: false, | ||
}, | ||
]); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('node_modules (posix)', function() { | ||
|