diff --git a/rollup.config.cli.js b/rollup.config.cli.js index 0e0eed6..95e8588 100644 --- a/rollup.config.cli.js +++ b/rollup.config.cli.js @@ -22,6 +22,7 @@ export default { }) ], external: [ + 'fs', 'path', 'module', 'source-map-support' diff --git a/test/cli/config-cwd-case-insensitive/_config.js b/test/cli/config-cwd-case-insensitive/_config.js new file mode 100644 index 0000000..d07b87d --- /dev/null +++ b/test/cli/config-cwd-case-insensitive/_config.js @@ -0,0 +1,13 @@ +var os = require( 'os' ); + +function toggleCase ( s ) { + return ( s == s.toLowerCase() ) ? s.toUpperCase() : s.toLowerCase(); +} + +module.exports = { + skip: os.platform() !== 'win32', + description: "can load config with cwd that doesn't match realpath", + command: 'rollup -c', + cwd: process.cwd().replace( /^[A-Z]:\\/ig, toggleCase ), + execute: true +}; diff --git a/test/cli/config-cwd-case-insensitive/main.js b/test/cli/config-cwd-case-insensitive/main.js new file mode 100644 index 0000000..df16c1b --- /dev/null +++ b/test/cli/config-cwd-case-insensitive/main.js @@ -0,0 +1 @@ +assert.equal( ANSWER, 42 ); diff --git a/test/cli/config-cwd-case-insensitive/rollup.config.js b/test/cli/config-cwd-case-insensitive/rollup.config.js new file mode 100644 index 0000000..3cc995e --- /dev/null +++ b/test/cli/config-cwd-case-insensitive/rollup.config.js @@ -0,0 +1,9 @@ +var replace = require( 'rollup-plugin-replace' ); + +module.exports = { + entry: 'main.js', + format: 'cjs', + plugins: [ + replace({ 'ANSWER': 42 }) + ] +}; diff --git a/test/test.js b/test/test.js index 3cc959b..0ba18fe 100644 --- a/test/test.js +++ b/test/test.js @@ -376,7 +376,7 @@ describe( 'rollup', function () { var config = loadConfig( CLI + '/' + dir + '/_config.js' ); ( config.skip ? it.skip : config.solo ? it.only : it )( dir, function ( done ) { - process.chdir( path.resolve( CLI, dir ) ); + process.chdir( config.cwd || path.resolve( CLI, dir ) ); const command = 'node ' + path.resolve( __dirname, '../bin' ) + path.sep + config.command;