Browse Source

Add test with treeshaking disabled

gh-669
Oskar Segersvärd 9 years ago
parent
commit
23777a067c
  1. 4
      test/cli/no-treeshake/_config.js
  2. 10
      test/cli/no-treeshake/_expected.js
  3. 3
      test/cli/no-treeshake/main.js
  4. 11
      test/form/no-treeshake/_config.js
  5. 20
      test/form/no-treeshake/_expected/amd.js
  6. 20
      test/form/no-treeshake/_expected/cjs.js
  7. 17
      test/form/no-treeshake/_expected/es6.js
  8. 21
      test/form/no-treeshake/_expected/iife.js
  9. 24
      test/form/no-treeshake/_expected/umd.js
  10. 1
      test/form/no-treeshake/foo.js
  11. 11
      test/form/no-treeshake/main.js
  12. 3
      test/form/no-treeshake/quux.js

4
test/cli/no-treeshake/_config.js

@ -0,0 +1,4 @@
module.exports = {
description: 'generates IIFE export with all code',
command: 'rollup main.js --format iife --name shakeless --no-treeshake'
};

10
test/cli/no-treeshake/_expected.js

@ -0,0 +1,10 @@
var shakeless = (function () {
'use strict';
const version = '1.2.0';
var main = ( x, y ) => x + y;
return main;
}());

3
test/cli/no-treeshake/main.js

@ -0,0 +1,3 @@
const version = '1.2.0';
export default ( x, y ) => x + y;

11
test/form/no-treeshake/_config.js

@ -0,0 +1,11 @@
module.exports = {
description: 'all code should be included if tree-shaking is disabled',
options: {
external: [ 'external' ],
globals: {
external: 'external'
},
moduleName: /* not shaken, but */ 'stirred',
treeshake: false
}
};

20
test/form/no-treeshake/_expected/amd.js

@ -0,0 +1,20 @@
define(['exports', 'external'], function (exports, external) { 'use strict';
var foo = 'unused';
const quux = 1;
const other = () => quux;
function bar () {
return foo;
}
function baz () {
return 13 + external.value;
}
exports.baz = baz;
exports.strange = quux;
});

20
test/form/no-treeshake/_expected/cjs.js

@ -0,0 +1,20 @@
'use strict';
var external = require('external');
var foo = 'unused';
const quux = 1;
const other = () => quux;
function bar () {
return foo;
}
function baz () {
return 13 + external.value;
}
exports.baz = baz;
exports.strange = quux;

17
test/form/no-treeshake/_expected/es6.js

@ -0,0 +1,17 @@
import * as external from 'external';
var foo = 'unused';
const quux = 1;
const other = () => quux;
function bar () {
return foo;
}
function baz () {
return 13 + external.value;
}
export { baz, quux as strange };

21
test/form/no-treeshake/_expected/iife.js

@ -0,0 +1,21 @@
(function (exports,external) {
'use strict';
var foo = 'unused';
const quux = 1;
const other = () => quux;
function bar () {
return foo;
}
function baz () {
return 13 + external.value;
}
exports.baz = baz;
exports.strange = quux;
}((this.stirred = this.stirred || {}),external));

24
test/form/no-treeshake/_expected/umd.js

@ -0,0 +1,24 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('external')) :
typeof define === 'function' && define.amd ? define(['exports', 'external'], factory) :
(factory((global.stirred = global.stirred || {}),global.external));
}(this, function (exports,external) { 'use strict';
var foo = 'unused';
const quux = 1;
const other = () => quux;
function bar () {
return foo;
}
function baz () {
return 13 + external.value;
}
exports.baz = baz;
exports.strange = quux;
}));

1
test/form/no-treeshake/foo.js

@ -0,0 +1 @@
export default 'unused';

11
test/form/no-treeshake/main.js

@ -0,0 +1,11 @@
import * as external from 'external';
import foo from './foo.js'
export { quux as strange } from './quux.js';
function bar () {
return foo;
}
export function baz () {
return 13 + external.value;
}

3
test/form/no-treeshake/quux.js

@ -0,0 +1,3 @@
export const quux = 1;
const other = () => quux;
Loading…
Cancel
Save