From 138003899dac88aefd31cf48335fdfa9b6e1781d Mon Sep 17 00:00:00 2001 From: Jasper De Moor Date: Sun, 6 Jan 2019 10:29:34 +0100 Subject: [PATCH] fix tests --- .../core/integration-tests/test/sourcemaps.js | 184 ------------------ 1 file changed, 184 deletions(-) diff --git a/packages/core/integration-tests/test/sourcemaps.js b/packages/core/integration-tests/test/sourcemaps.js index 42c7d374206..dad3d802d18 100644 --- a/packages/core/integration-tests/test/sourcemaps.js +++ b/packages/core/integration-tests/test/sourcemaps.js @@ -2,7 +2,6 @@ const assert = require('assert'); const fs = require('@parcel/fs'); const path = require('path'); const mapValidator = require('sourcemap-validator'); -const SourceMap = require('../src/SourceMap'); const {bundler, bundle, run, assertBundleTree} = require('./utils'); describe('sourcemaps', function() { @@ -315,187 +314,4 @@ describe('sourcemaps', function() { ); mapValidator(jsOutput, map); }); - - it('should purify mappings properly', async function() { - let mappings = [ - { - source: 'index.js', - name: 'A', - original: { - line: 0, - column: 0 - }, - generated: { - line: 0, - column: 0 - } - }, - { - generated: { - line: 1, - column: 0 - }, - original: null, - source: null, - name: null - }, - { - generated: { - line: 1, - column: 0 - }, - original: null, - source: null, - name: null - }, - { - generated: { - line: 1, - column: 0 - }, - original: { - line: 0, - column: 0 - }, - source: null, - name: null - }, - { - generated: { - line: 1, - column: 0 - }, - original: { - line: 1, - column: 0 - }, - source: null, - name: null - }, - { - generated: { - line: 1, - column: 0 - }, - original: { - line: 1, - column: 0 - }, - source: 'index.js', - name: null - }, - { - generated: { - line: 1, - column: 0 - }, - original: { - line: 0, - column: 0 - }, - source: 'index.js', - name: null - }, - { - source: 'index.js', - name: 'A', - original: { - line: 1, - column: 18 - }, - generated: { - line: 4, - column: 187 - } - } - ]; - let expectedResult = [ - { - generated: { - line: 1, - column: 0 - }, - original: null, - source: null, - name: null - }, - { - generated: { - line: 1, - column: 0 - }, - original: null, - source: null, - name: null - }, - { - generated: { - line: 1, - column: 0 - }, - original: { - line: 1, - column: 0 - }, - source: 'index.js', - name: null - }, - { - source: 'index.js', - name: 'A', - original: { - line: 1, - column: 18 - }, - generated: { - line: 4, - column: 187 - } - } - ]; - let sourcemap = new SourceMap(mappings, {}); - assert.deepEqual(sourcemap.mappings, expectedResult); - }); - it('should be able to handle null mappings properly', async function() { - let mappings = [ - { - generated: { - line: 1, - column: 0 - }, - original: { - line: 1, - column: 0 - }, - source: 'input.js', - name: 'console' - }, - { - generated: { - line: 1, - column: 7 - }, - original: null, - source: null, - name: null - } - ]; - let sources = { - 'input.js': 'console.log("hello world!");' - }; - let sourcemap = new SourceMap(mappings, sources); - assert.equal(sourcemap.mappings.length, 2); - assert.deepEqual(sourcemap.mappings, mappings); - let mapString = sourcemap.stringify('index.map', '/'); - let combinedSourcemap = new SourceMap(mappings, sources); - await combinedSourcemap.addMap(mapString); - let newMapString = combinedSourcemap.stringify('index.map', '/'); - assert.equal(mapString, newMapString); - let newSourcemap = new SourceMap([], {}); - await newSourcemap.addMap(sourcemap); - assert.deepEqual(newSourcemap.mappings, mappings); - newSourcemap = new SourceMap([], {}); - await newSourcemap.addMap(mapString); - assert.deepEqual(newSourcemap.mappings, mappings); - }); });