Sha256: 5bcbdd6ea5372a71cde5e5b1ada732e4b5ad853808db27bde90a9bae1f9c3e0b

Contents?: true

Size: 1.19 KB

Versions: 7

Compression:

Stored size: 1.19 KB

Contents

var test = require('tape');
var convert = require('convert-source-map');
var insert = require('../');
var mdeps = require('module-deps');
var vm = require('vm');

test('sourcemap', function (t) {
    t.plan(6);
    
    var file = __dirname + '/sourcemap/main.js';
    var deps = mdeps()
    
    deps.on('data', function(row) {
        var src = row.source;
        
        var sm = convert.fromSource(src).toObject();
        t.deepEqual(sm.sources, [ 'test/sourcemap/main_es6.js' ]);
        t.deepEqual(sm.sourcesContent, [ 'console.log(`${__dirname}`, `${__filename}`);\n' ]);
        t.deepEqual(sm.mappings, ';AAAA,OAAO,CAAC,GAAG,MAAI,SAAS,OAAO,UAAU,CAAG,CAAC');
        
        t.equal(src.match(convert.commentRegex).length, 1);
        
        var c = {
            console: {
                log: function(dirname, filename) {
                    t.equal(dirname, '/');
                    t.equal(filename, '/main.js');
                }
            },
        };
        vm.runInNewContext(src, c);
    });
    
    deps.write({ transform: inserter, global: true });
    deps.end(file);
});

function inserter (file) {
    return insert(file, { debug: true, basedir: __dirname + '/sourcemap' });
}

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
minimum_viable_product-0.0.11 test/dummy/node_modules/insert-module-globals/test/sourcemap.js
brwy_rails-0.0.6 test/dummy/node_modules/insert-module-globals/test/sourcemap.js
brwy_rails-0.0.5 test/dummy/node_modules/insert-module-globals/test/sourcemap.js
brwy_rails-0.0.4 test/dummy/node_modules/insert-module-globals/test/sourcemap.js
brwy_rails-0.0.3 test/dummy/node_modules/insert-module-globals/test/sourcemap.js
brwy_rails-0.0.2 test/dummy/node_modules/insert-module-globals/test/sourcemap.js
brwy_rails-0.0.1 test/dummy/node_modules/insert-module-globals/test/sourcemap.js