Browse Source

Set directory before each sourcemap test so that it can be depended on. Remove relative-paths' dependency on path.relative with process.cwd() which doesn't work in some situations.

semi-dynamic-namespace-imports
Kurt Blackwell 9 years ago
parent
commit
e37bc0be8d
  1. 2
      test/cli/config-cwd-case-insensitive/_config.js
  2. 6
      test/sourcemaps/relative-paths/_config.js
  3. 2
      test/test.js

2
test/cli/config-cwd-case-insensitive/_config.js

@ -8,6 +8,6 @@ module.exports = {
skip: os.platform() !== 'win32', skip: os.platform() !== 'win32',
description: "can load config with cwd that doesn't match realpath", description: "can load config with cwd that doesn't match realpath",
command: 'rollup -c', command: 'rollup -c',
cwd: process.cwd().replace( /^[A-Z]:\\/ig, toggleCase ), cwd: __dirname.replace( /^[A-Z]:\\/i, toggleCase ),
execute: true execute: true
}; };

6
test/sourcemaps/relative-paths/_config.js

@ -1,13 +1,11 @@
var path = require( 'path' ); var path = require( 'path' );
var assert = require( 'assert' ); var assert = require( 'assert' );
var pathRelativeToCwd = path.relative( process.cwd(), path.resolve( __dirname, '_actual/bundle.js' ) );
module.exports = { module.exports = {
description: 'source paths are relative (#344)', description: 'source paths are relative with relative dest (#344)',
options: { options: {
moduleName: 'myModule', moduleName: 'myModule',
dest: pathRelativeToCwd dest: path.resolve( '_actual/bundle.js' )
}, },
test: function ( code, map ) { test: function ( code, map ) {
assert.deepEqual( map.sources, [ '../main.js' ]); assert.deepEqual( map.sources, [ '../main.js' ]);

2
test/test.js

@ -338,6 +338,7 @@ describe( 'rollup', function () {
if ( dir[0] === '.' ) return; // .DS_Store... if ( dir[0] === '.' ) return; // .DS_Store...
describe( dir, function () { describe( dir, function () {
process.chdir( SOURCEMAPS + '/' + dir );
var config = loadConfig( SOURCEMAPS + '/' + dir + '/_config.js' ); var config = loadConfig( SOURCEMAPS + '/' + dir + '/_config.js' );
var entry = path.resolve( SOURCEMAPS, dir, 'main.js' ); var entry = path.resolve( SOURCEMAPS, dir, 'main.js' );
@ -349,6 +350,7 @@ describe( 'rollup', function () {
PROFILES.forEach( function ( profile ) { PROFILES.forEach( function ( profile ) {
( config.skip ? it.skip : config.solo ? it.only : it )( 'generates ' + profile.format, function () { ( config.skip ? it.skip : config.solo ? it.only : it )( 'generates ' + profile.format, function () {
process.chdir( SOURCEMAPS + '/' + dir );
return rollup.rollup( options ).then( function ( bundle ) { return rollup.rollup( options ).then( function ( bundle ) {
var options = extend( {}, { var options = extend( {}, {
format: profile.format, format: profile.format,

Loading…
Cancel
Save