11'use strict' ;
2+ const fs = require ( 'fs' ) ;
3+ const path = require ( 'path' ) ;
4+ const babel = require ( 'babel-core' ) ;
25
3- var babel = require ( ' babel-core' ) ;
4- var fs = require ( 'fs' ) ;
5- var path = require ( 'path' ) ;
6+ const transformed = babel . transform ( `
7+ import {mapFile} from 'source-map-fixtures' ;
8+ import test from '../../' ;
69
7- var transformed = babel . transform ( [
8- "import { mapFile } from 'source-map-fixtures'" ,
9- "import test from '../../'" ,
10- "const fixture = mapFile('throws').require()" ,
11- // The uncaught exception is passed to the corresponding cli test. The line
12- // numbers from the 'throws' fixture (which uses a map file), as well as the
13- // line of the fixture.run() call, should match the source lines from this
14- // string.
15- "test('throw an uncaught exception', t => {" ,
16- " setImmediate(run)" ,
17- "})" ,
18- "const run = () => fixture.run()"
19- ] . join ( '\n' ) , {
10+ const fixture = mapFile('throws').require();
11+
12+ // The uncaught exception is passed to the corresponding cli test. The line
13+ // numbers from the 'throws' fixture (which uses a map file), as well as the
14+ // line of the fixture.run() call, should match the source lines from this
15+ // string.
16+ test('throw an uncaught exception', t => {
17+ setImmediate(run);
18+ })
19+ const run = () => fixture.run();
20+ ` , {
2021 filename : 'source-map-initial-input.js' ,
2122 sourceMaps : true
2223} ) ;
@@ -27,4 +28,5 @@ fs.writeFileSync(
2728fs . writeFileSync (
2829 path . join ( __dirname , 'source-map-initial.js.map' ) ,
2930 JSON . stringify ( transformed . map ) ) ;
31+
3032console . log ( 'Generated source-map-initial.js' ) ;
0 commit comments