diff --git a/test/function/relative-external-include-once-two-external/_config.js b/test/function/relative-external-include-once-two-external/_config.js new file mode 100644 index 0000000..d83e72f --- /dev/null +++ b/test/function/relative-external-include-once-two-external/_config.js @@ -0,0 +1,22 @@ +var assert = require( 'assert' ); +var path = require( 'path' ); + + +module.exports = { + description: 'includes a relative external module only once (two external deps)', + options: { + external: [ + path.join( __dirname, './foo.js' ), + path.join( __dirname, './first/foo.js' ) + ] + }, + context: { + require: function ( required ) { + assert( [ './foo.js', './first/foo.js' ].indexOf(required) !== -1, 'required wrong module' ); + return required === './foo.js' ? 'a' : 'b'; + } + }, + exports: function ( exports ) { + assert( exports === 'ab' || exports === 'ba', 'two different modules should be required' ); + } +}; diff --git a/test/function/relative-external-include-once-two-external/first/foo.js b/test/function/relative-external-include-once-two-external/first/foo.js new file mode 100644 index 0000000..e69de29 diff --git a/test/function/relative-external-include-once-two-external/first/module.js b/test/function/relative-external-include-once-two-external/first/module.js new file mode 100644 index 0000000..4ad6554 --- /dev/null +++ b/test/function/relative-external-include-once-two-external/first/module.js @@ -0,0 +1,3 @@ +import foo from './foo'; + +export default foo; diff --git a/test/function/relative-external-include-once-two-external/foo.js b/test/function/relative-external-include-once-two-external/foo.js new file mode 100644 index 0000000..e69de29 diff --git a/test/function/relative-external-include-once-two-external/main.js b/test/function/relative-external-include-once-two-external/main.js new file mode 100644 index 0000000..dff375c --- /dev/null +++ b/test/function/relative-external-include-once-two-external/main.js @@ -0,0 +1,4 @@ +import foo from './foo'; +import first from './first/module'; + +export default foo + first;