mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
updated the test cases to handle the empty string, valid JS, invalid JS cases and then a case to check the error object has the fields we need and one to keep tabs on the numeric separator support I requested (I'll remove it when it fails)
This commit is contained in:
@@ -1,6 +1,31 @@
|
||||
Tinytest.add('minifier-js - verify terser is able to minify files', (test) => {
|
||||
let terserResult = meteorJsMinify('function add(first,second){return first + second; }\n');
|
||||
test.equal(terserResult.code, 'function add(n,d){return n+d}');
|
||||
Tinytest.add('minifier-js - verify how terser handles an empty string', (test) => {
|
||||
let result = meteorJsMinify('');
|
||||
test.equal(result.code, '');
|
||||
test.equal(result.minifier, 'terser');
|
||||
});
|
||||
|
||||
Tinytest.add('minifier-js - verify terser is able to minify valid javascript', (test) => {
|
||||
let result = meteorJsMinify('function add(first,second){return first + second; }\n');
|
||||
test.equal(result.code, 'function add(n,d){return n+d}');
|
||||
test.equal(result.minifier, 'terser');
|
||||
});
|
||||
|
||||
Tinytest.add('minifier-js - verify error handling is done as expected', (test) => {
|
||||
test.throws( () => meteorJsMinify('let name = {;\n'), undefined );
|
||||
});
|
||||
|
||||
Tinytest.add('minifier-js - verify tersers error object has the fields we use for reporting errors to users', (test) => {
|
||||
let result;
|
||||
try {
|
||||
result = meteorJsMinify('let name = {;\n');
|
||||
}
|
||||
catch (err) {
|
||||
test.isNotUndefined(err.name);
|
||||
test.isNotUndefined(err.message);
|
||||
test.isNotUndefined(err.filename);
|
||||
test.isNotUndefined(err.line);
|
||||
test.isNotUndefined(err.col);
|
||||
}
|
||||
});
|
||||
|
||||
// this feature has been reqested in this issue https://github.com/terser/terser/issues/632
|
||||
@@ -8,8 +33,4 @@ Tinytest.add('minifier-js - verify terser is able to minify files', (test) => {
|
||||
// its been done and can remove this test :)
|
||||
Tinytest.add('minifier-js - unsupported feature test (numeric seperators)', (test) => {
|
||||
test.throws(() => meteorJsMinify('let number = 1_000_000_000_000;\n') );
|
||||
});
|
||||
|
||||
Tinytest.add('minifier-js - verify error handling is done correctly', (test) => {
|
||||
test.throws(() => meteorJsMinify('let name = {;\n'));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user