Browse Source

Add a test for loading config when the drive letter doesn't match after realpath. List 'fs' as external dependency.

semi-dynamic-namespace-imports
Kurt Blackwell 9 years ago
parent
commit
5605ce5c85
  1. 1
      rollup.config.cli.js
  2. 13
      test/cli/config-cwd-case-insensitive/_config.js
  3. 1
      test/cli/config-cwd-case-insensitive/main.js
  4. 9
      test/cli/config-cwd-case-insensitive/rollup.config.js
  5. 2
      test/test.js

1
rollup.config.cli.js

@ -22,6 +22,7 @@ export default {
})
],
external: [
'fs',
'path',
'module',
'source-map-support'

13
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
};

1
test/cli/config-cwd-case-insensitive/main.js

@ -0,0 +1 @@
assert.equal( ANSWER, 42 );

9
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 })
]
};

2
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;

Loading…
Cancel
Save