Skip to content

Commit

Permalink
reverts
Browse files Browse the repository at this point in the history
  • Loading branch information
nmccready committed Jul 25, 2017
1 parent 1722412 commit 0923ca5
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 108 deletions.
13 changes: 1 addition & 12 deletions .travis.yml
Expand Up @@ -13,23 +13,12 @@ cache:
- node_modules

install:
- npm i -g npm@4.5.X
- npm i -g npm@latest
- npm install
- echo `npm --version`

after_script:
- npm run coveralls

branches:
except:
- /^v[0-9]/
env:
global:
- CXX=g++-4.8
- NUM_MEMORY_TESTS=10
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
2 changes: 0 additions & 2 deletions package.json
Expand Up @@ -37,7 +37,6 @@
"vinyl": "1.X"
},
"devDependencies": {
"bluebird": "^3.5.0",
"bootstrap": "3.3.7",
"coveralls": "2.X",
"faucet": "0.0.X",
Expand All @@ -51,7 +50,6 @@
"istanbul": "0.X",
"jshint": "2.X",
"lodash": "4.17.4",
"memwatch-next": "^0.3.0",
"mississippi": "^1.3.0",
"object-assign": "^4.1.0",
"tape": "4.X",
Expand Down
7 changes: 0 additions & 7 deletions test/init.js
Expand Up @@ -75,13 +75,6 @@ function makeFileCSS() {
});
}

var startDate = Date.now();

test.onFinish(function(){
var delta = Date.now() - startDate;
console.log("Total Test Time: " + delta);
});

test('init: should pass through when file is null', function(t) {
// end inner conflict
var file = new File();
Expand Down
102 changes: 22 additions & 80 deletions test/integration.js
Expand Up @@ -5,8 +5,6 @@ var test = require('tape');
var sourcemaps = require('..');
var yargs = require('yargs').argv;
var debug = require('debug-fabulous')();
var Promise = require('bluebird');

if (!yargs.ignoreLogTests){
debug.save('gulp-sourcemaps:*');
debug.enable(debug.load());
Expand All @@ -16,8 +14,6 @@ var fs = require('fs');
var sourceContent = fs.readFileSync(join(__dirname, 'assets/helloworld.js')).toString();
var _ = require('lodash');

var memwatch = require('memwatch-next');
var heapDiff;

function base64JSON(object) {
return 'data:application/json;charset=utf8;base64,' + new Buffer(JSON.stringify(object)).toString('base64');
Expand All @@ -31,23 +27,6 @@ function moveHtml(dest, t){

debug('running');

var startDate = Date.now();

test.onFinish(function(){
var delta = Date.now() - startDate;
console.log("Total Test Time: " + delta);

var hde = heapDiff.end();
var change = hde.change;
change.details = null;

console.log(JSON.stringify({
before: hde.before,
after: hde.after,
change: change
}, null, 2));
});

test('combined: creates inline mapping', function(t) {

gulp.src(join(__dirname, './assets/helloworld.js'))
Expand All @@ -72,30 +51,6 @@ test('combined: creates inline mapping', function(t) {
});
});

test('leak', function(t) {

gulp.src(join(__dirname, './assets/helloworld.js'))
.pipe(sourcemaps.init())
.pipe(sourcemaps.write())
// .pipe(gulp.dest('tmp'))
.on('data', function(data) {
t.ok(data.sourceMap, 'should add a source map object');
t.deepEqual(
data.contents.toString(),
sourceContent + '\n//# sourceMappingURL=' + base64JSON(data.sourceMap) + '\n',
'file should be sourcemapped'
);
t.end();
})
.on('error', function() {
t.fail('emitted error');
t.end();
})
.on('close', function() {
t.end();
});
});

test('combined: creates preExistingComment , no new previous line', function(t) {
gulp.src(join(__dirname, './assets/helloworld.map.js'))
.pipe(sourcemaps.init({loadMaps:true}))
Expand Down Expand Up @@ -310,42 +265,29 @@ test('sources: is valid with concat', function(t) {
});

// - thanks @twiggy https://github.com/floridoo/gulp-sourcemaps/issues/270#issuecomment-271723208
test('leak', function(t) {
var promises = [];
heapDiff = new memwatch.HeapDiff();
function addPromise(i){
promises.push(new Promise(function(resolve, reject){
gulp.src([
join(__dirname, './assets/test3.js'),
join(__dirname, './assets/test4.js'),
])
.pipe(sourcemaps.init())
.pipe($.concat("index.js"))
.pipe(sourcemaps.write('.', {mapSourcesAbsolute:true}))
.pipe(gulp.dest('tmp/sources_concat' + i))
.on('data', function(file) {
if (!/.*\.map/.test(file.path)) return;

var contents = JSON.parse(file.contents.toString());
_.each(contents.sources, function(s, i){
t.deepEqual(s, "/test/assets/test" + (i+3) + ".js", "source is correct, test" + (i+3) + ".js");
});
})
.on('error', reject)
.on('finish', resolve);
}));
}
test('sources: mapSourcesAbsolute: is valid with concat', function(t) {

var numOfTests = process.env.NUM_MEMORY_TESTS ? parseInt(process.env.NUM_MEMORY_TESTS) : 100;

for(var i = 0; i < numOfTests; i++){
addPromise(i);
}
gulp.src([
join(__dirname, './assets/test3.js'),
join(__dirname, './assets/test4.js'),
])
.pipe(sourcemaps.init())
.pipe($.concat("index.js"))
.pipe(sourcemaps.write('.', {mapSourcesAbsolute:true}))
.pipe(gulp.dest('tmp/sources_concat'))
.on('data', function(file) {
if (!/.*\.map/.test(file.path)) return;

Promise.all(promises)
.then(function(tests){
console.log("=======================\n\n"+ tests.length + " done!!");
t.end();
var contents = JSON.parse(file.contents.toString());
_.each(contents.sources, function(s, i){
t.deepEqual(s, "/test/assets/test" + (i+3) + ".js", "source is correct, test" + (i+3) + ".js");
});
})
.catch(t.fail);
.on('error', function() {
t.fail('emitted error');
t.end();
}).on('finish', function(){
moveHtml('sources_concat', t);
});

});
7 changes: 0 additions & 7 deletions test/write.js
Expand Up @@ -90,13 +90,6 @@ function makeStreamFile() {
return file;
}

var startDate = Date.now();

test.onFinish(function(){
var delta = Date.now() - startDate;
console.log("Total Test Time: " + delta);
});

test('write: should pass through when file is null', function(t) {
var file = new File();
var pipeline = sourcemaps.write();
Expand Down

0 comments on commit 0923ca5

Please sign in to comment.