Skip to content

Commit

Permalink
outwit uglify, which now tries to inline stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Mar 9, 2017
1 parent 1b0823a commit d3c19ed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions test/sourcemaps/names-transformed/_config.js
Expand Up @@ -5,6 +5,7 @@ var getLocation = require( '../../utils/getLocation' );
var SourceMapConsumer = require( 'source-map' ).SourceMapConsumer;

module.exports = {
solo: true,
description: 'names are recovered if transforms are used',
options: {
plugins: [
Expand Down Expand Up @@ -35,7 +36,7 @@ module.exports = {
test: function ( code, map ) {
var smc = new SourceMapConsumer( map );

var generatedLoc = getLocation( code, /\w+=1/.exec( code ).index );
var generatedLoc = getLocation( code, /\w+=["']this/.exec( code ).index );
var originalLoc = smc.originalPositionFor( generatedLoc );

assert.deepEqual( originalLoc, {
Expand All @@ -45,7 +46,7 @@ module.exports = {
name: 'mangleMe'
});

generatedLoc = getLocation( code, /\w+=2/.exec( code ).index );
generatedLoc = getLocation( code, /\w+=["']nor/.exec( code ).index );
originalLoc = smc.originalPositionFor( generatedLoc );

assert.deepEqual( originalLoc, {
Expand Down
2 changes: 1 addition & 1 deletion test/sourcemaps/names-transformed/a.js
@@ -1,4 +1,4 @@
var mangleMe = 1;
var mangleMe = "this string should not be inlined".toLowerCase();
export default function () {
assert.equal( mangleMe, 1 );
}
2 changes: 1 addition & 1 deletion test/sourcemaps/names-transformed/b.js
@@ -1,4 +1,4 @@
var mangleMe = 2;
var mangleMe = "nor should this one".toLowerCase();
export default function () {
assert.equal( mangleMe, 2 );
}

0 comments on commit d3c19ed

Please sign in to comment.