mirror of https://github.com/lukechilds/rollup.git
8 changed files with 75 additions and 29 deletions
@ -0,0 +1,7 @@ |
|||||
|
export function find ( array, fn ) { |
||||
|
for ( let i = 0; i < array.length; i += 1 ) { |
||||
|
if ( fn( array[i], i ) ) return array[i]; |
||||
|
} |
||||
|
|
||||
|
return null; |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
const assert = require( 'assert' ); |
||||
|
|
||||
|
let warnings = []; |
||||
|
|
||||
|
module.exports = { |
||||
|
description: 'preserves sourcemap chains when transforming', |
||||
|
before: () => warnings = [], // reset
|
||||
|
options: { |
||||
|
plugins: [ |
||||
|
{ |
||||
|
name: 'fake plugin', |
||||
|
transform: function ( code ) { |
||||
|
return code; |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
onwarn ( msg ) { |
||||
|
warnings.push( msg ); |
||||
|
} |
||||
|
}, |
||||
|
test: () => { |
||||
|
assert.deepEqual( warnings, [ |
||||
|
`Sourcemap is likely to be incorrect: a plugin ('fake plugin') was used to transform files, but didn't generate a sourcemap for the transformation. Consult https://github.com/rollup/rollup/wiki/Troubleshooting and the plugin documentation for more information` |
||||
|
]); |
||||
|
} |
||||
|
}; |
@ -0,0 +1 @@ |
|||||
|
console.log( 42 ); |
Loading…
Reference in new issue