Tests for minifiers errors

This commit is contained in:
Slava Kim
2015-06-16 11:57:29 -07:00
parent 886c656a31
commit 3c7a86fc3c
16 changed files with 156 additions and 0 deletions

View File

@@ -0,0 +1 @@
local

View File

@@ -0,0 +1,7 @@
# Meteor packages used by this project, one per line.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
meteor-platform
local-plugin

View File

@@ -0,0 +1 @@
none

View File

@@ -0,0 +1,5 @@
Package.registerBuildPlugin({
name: "bad-minifier",
use: ['minifier-plugin'],
sources: ['plugin.js']
});

View File

@@ -0,0 +1,11 @@
Plugin.registerMinifier({
extensions: ["foo"],
}, function () {
var minifier = new Minifier();
return minifier;
});
function Minifier () {};
Minifier.prototype.processFilesForTarget = function (files) { };

View File

@@ -0,0 +1 @@
local

View File

@@ -0,0 +1,7 @@
# This file contains a token that is unique to your project.
# Check it into your repository along with the rest of this directory.
# It can be used for purposes such as:
# - ensuring you don't accidentally deploy one app on top of another
# - providing package authors with aggregated statistics
ogxdzy1on9lml15n20q5

View File

@@ -0,0 +1,8 @@
# Meteor packages used by this project, one per line.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
meteor-platform
local-plugin
local-plugin-2

View File

@@ -0,0 +1,2 @@
browser
server

View File

@@ -0,0 +1,53 @@
autoupdate@1.2.2
base64@1.0.3
binary-heap@1.0.3
blaze@2.1.2
blaze-tools@1.0.3
boilerplate-generator@1.0.3
callback-hook@1.0.3
check@1.0.5
ddp@1.2.0
ddp-client@1.2.0
ddp-common@1.2.0
ddp-server@1.2.0
deps@1.0.7
ejson@1.0.6
fastclick@1.0.6
geojson-utils@1.0.3
html-tools@1.0.4
htmljs@1.0.4
http@1.1.0
id-map@1.0.3
jquery@1.11.3_2
json@1.0.3
launch-screen@1.0.3
livedata@1.0.13
local-plugin@0.0.0
local-plugin-2@0.0.0
logging@1.0.8
meteor@1.1.6
meteor-platform@1.2.2
minifier-plugin@1.0.0
minifiers@1.1.5
minimongo@1.0.8
mobile-status-bar@1.0.4
mongo@1.1.0
npm-mongo@1.4.32_1
observe-sequence@1.0.6
ordered-dict@1.0.3
random@1.0.3
reactive-dict@1.1.0
reactive-var@1.0.5
reload@1.1.3
retry@1.0.3
routepolicy@1.0.5
session@1.1.0
spacebars@1.0.6
spacebars-compiler@1.0.6
templating@1.1.1
tracker@1.0.7
ui@1.0.6
underscore@1.0.3
url@1.0.4
webapp@1.2.1
webapp-hashing@1.0.3

View File

@@ -0,0 +1,5 @@
Package.registerBuildPlugin({
name: "bad-minifier-2",
use: ['minifier-plugin'],
sources: ['plugin.js']
});

View File

@@ -0,0 +1,11 @@
Plugin.registerMinifier({
extensions: ["js"],
}, function () {
var minifier = new Minifier();
return minifier;
});
function Minifier () {};
Minifier.prototype.processFilesForTarget = function (files) { };

View File

@@ -0,0 +1,5 @@
Package.registerBuildPlugin({
name: "bad-minifier",
use: ['minifier-plugin'],
sources: ['plugin.js']
});

View File

@@ -0,0 +1,11 @@
Plugin.registerMinifier({
extensions: ["js"],
}, function () {
var minifier = new Minifier();
return minifier;
});
function Minifier () {};
Minifier.prototype.processFilesForTarget = function (files) { };

View File

@@ -0,0 +1,27 @@
var selftest = require('../selftest.js');
var Sandbox = selftest.Sandbox;
selftest.define("minifiers can't register non-js/non-css extensions", [], function () {
var s = new Sandbox();
var run;
s.createApp("myapp", "minifier-plugin-bad-extension", { dontPrepareApp: true });
s.cd("myapp");
run = s.run();
run.match("foo: Minifiers are only allowed to register \"css\" or \"js\" extensions.");
run.stop();
});
selftest.define("minifiers: apps can't use more than one package providing a minifier for the same extension", [], function () {
var s = new Sandbox();
var run;
s.createApp("myapp", "minifier-plugin-multiple-minifiers-for-js", { dontPrepareApp: true });
s.cd("myapp");
run = s.run("--production");
run.match("local-plugin, local-plugin-2: multiple packages registered minifiers for extension \"js\".");
run.stop();
});