Skip to content

Commit dcde426

Browse files
committed
switched to ESM as default format for test bundles
ESM will become our default output format in the future, this prepares our tests for it.
1 parent 19e60f0 commit dcde426

35 files changed

+49
-88
lines changed

test/cli/run

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ end
1414

1515
begin "$root/test_basic" # once more with fingerprinting
1616
faucet --fingerprint
17-
assert_identical "./dist/bundle-3930f63318329292cd52218fdbd7a70d.js" "./expected.js"
17+
assert_identical "./dist/bundle-56a55e40e1b060b637dba590df3ff10b.js" "./expected.js"
1818
end
1919

2020
begin "$root/test_transpilation"
@@ -64,13 +64,14 @@ end
6464

6565
begin "$root/test_fingerprinting"
6666
faucet --fingerprint
67-
assert_identical "./dist/bundle-3930f63318329292cd52218fdbd7a70d.js" "./expected.js"
67+
assert_identical "./dist/bundle-56a55e40e1b060b637dba590df3ff10b.js" "./expected.js"
6868
assert_identical "./dist/bundle_alt.js" "./expected.js"
6969
end
7070

7171
begin "$root/test_bundle_customization"
7272
faucet
73-
assert_identical "./dist/bundle.js" "./expected.js"
73+
assert_identical "./dist/bundle_iife.js" "./expected_iife.js"
74+
assert_identical "./dist/bundle_umd.js" "./expected_umd.js"
7475
assert_identical "./dist/bundle_cjs.js" "./expected_cjs.js"
7576
end
7677

test/cli/test_basic/expected.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
(function () {
2-
'use strict';
3-
41
var util = "UTIL";
52

63
console.log(`[…] ${util}`);
7-
8-
}());

test/cli/test_basic/faucet.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ let path = require("path");
55
module.exports = {
66
js: [{
77
source: "./src/index.js",
8-
target: "./dist/bundle.js"
8+
target: "./dist/bundle.js",
9+
format: "esm"
910
}],
1011
plugins: [path.resolve(__dirname, "../../..")]
1112
};
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
(function () {
2-
'use strict';
3-
41
class Util {}
52
const FOO = "lorem ipsum";
63
const BAR = "dolor sit amet";
74

85
console.log(`~~ ${Util} ~~ ${FOO} ~~ ${BAR} ~~`);
9-
10-
}());

test/cli/test_browserslist/expected_legacy.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
(function () {
2-
'use strict';
3-
41
function _classCallCheck(instance, Constructor) {
52
if (!(instance instanceof Constructor)) {
63
throw new TypeError("Cannot call a class as a function");
@@ -14,5 +11,3 @@ var FOO = "lorem ipsum";
1411
var BAR = "dolor sit amet";
1512

1613
console.log("~~ ".concat(Util, " ~~ ").concat(FOO, " ~~ ").concat(BAR, " ~~"));
17-
18-
}());

test/cli/test_browserslist/faucet.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@ module.exports = {
66
js: [{
77
source: "./src/index.js",
88
target: "./dist/bundle.js",
9+
format: "esm",
910
esnext: true
1011
}, {
1112
source: "./src/index.js",
1213
target: "./dist/bundle_alt.js",
14+
format: "esm",
1315
esnext: {
1416
browserslist: false
1517
}
1618
}, {
1719
source: "./src/index.js",
1820
target: "./dist/bundle_legacy.js",
21+
format: "esm",
1922
esnext: {
2023
browserslist: "legacy"
2124
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var MYLIB = (function () {
2+
'use strict';
3+
4+
var index = _ => {
5+
console.log("lipsum");
6+
};
7+
8+
return index;
9+
10+
}());

test/cli/test_bundle_customization/faucet.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ let path = require("path");
55
module.exports = {
66
js: [{
77
source: "./src/index.js",
8-
target: "./dist/bundle.js",
8+
target: "./dist/bundle_umd.js",
99
format: "umd",
1010
exports: "MYLIB"
11+
}, {
12+
source: "./src/index.js",
13+
target: "./dist/bundle_iife.js",
14+
exports: "MYLIB"
1115
}, {
1216
source: "./src/index.js",
1317
target: "./dist/bundle_cjs.js",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
(function(){'use strict';var util = "UTIL";function info() {
1+
var util = "UTIL";function info() {
22
console.log(`[…] ${util}`);
33
}
44
function help() {
55
info();
66
}
7-
help();}());
7+
help();

0 commit comments

Comments
 (0)