[react-packager] Correct module extension regexp
This commit is contained in:
parent
e3ce3d0d84
commit
21f45e8899
|
@ -64,6 +64,42 @@ describe('DependencyGraph', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
pit('should get dependencies with the correct extensions', function() {
|
||||||
|
var root = '/root';
|
||||||
|
fs.__setMockFilesystem({
|
||||||
|
'root': {
|
||||||
|
'index.js': [
|
||||||
|
'/**',
|
||||||
|
' * @providesModule index',
|
||||||
|
' */',
|
||||||
|
'require("a")'
|
||||||
|
].join('\n'),
|
||||||
|
'a.js': [
|
||||||
|
'/**',
|
||||||
|
' * @providesModule a',
|
||||||
|
' */',
|
||||||
|
].join('\n'),
|
||||||
|
'a.js.orig': [
|
||||||
|
'/**',
|
||||||
|
' * @providesModule a',
|
||||||
|
' */',
|
||||||
|
].join('\n'),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var dgraph = new DependencyGraph({
|
||||||
|
roots: [root],
|
||||||
|
fileWatcher: fileWatcher
|
||||||
|
});
|
||||||
|
return dgraph.load().then(function() {
|
||||||
|
expect(dgraph.getOrderedDependencies('/root/index.js'))
|
||||||
|
.toEqual([
|
||||||
|
{id: 'index', altId: '/root/index.js', path: '/root/index.js', dependencies: ['a']},
|
||||||
|
{id: 'a', altId: '/root/a.js', path: '/root/a.js', dependencies: []},
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
pit('should get dependencies with deprecated assets', function() {
|
pit('should get dependencies with deprecated assets', function() {
|
||||||
var root = '/root';
|
var root = '/root';
|
||||||
fs.__setMockFilesystem({
|
fs.__setMockFilesystem({
|
||||||
|
|
|
@ -65,7 +65,7 @@ function DependecyGraph(options) {
|
||||||
this._debugUpdateEvents = [];
|
this._debugUpdateEvents = [];
|
||||||
|
|
||||||
this._moduleExtPattern = new RegExp(
|
this._moduleExtPattern = new RegExp(
|
||||||
'.' + ['js'].concat(this._assetExts).join('|') + '$'
|
'\.(' + ['js'].concat(this._assetExts).join('|') + ')$'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Kick off the search process to precompute the dependency graph.
|
// Kick off the search process to precompute the dependency graph.
|
||||||
|
|
Loading…
Reference in New Issue