You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
817 B

const path = require( 'path' );
const assert = require( 'assert' );
module.exports = {
description: 'bundle.modules includes dependencies (#903)',
bundle ( bundle ) {
const modules = bundle.modules.map( module => {
return {
id: path.relative( __dirname, module.id ),
dependencies: module.dependencies.map( id => path.relative( __dirname, id ) )
};
});
assert.deepEqual( modules, [
{
id: path.normalize( 'nested/qux.js' ),
dependencies: []
},
{
id: path.normalize( 'nested/baz.js' ),
dependencies: [ path.normalize( 'nested/qux.js' ) ]
},
{
id: 'bar.js',
dependencies: [ path.normalize( 'nested/baz.js' ) ]
},
{
id: 'foo.js',
dependencies: [ 'bar.js' ]
},
{
id: 'main.js',
dependencies: [ 'foo.js', 'bar.js' ]
}
]);
}
};