Skip to content

Commit fd3b80b

Browse files
author
Jason Bedard
committed
fixup! feat(rollup): provide output groupings of js+map for each bundle type
1 parent 98968de commit fd3b80b

File tree

4 files changed

+84
-25
lines changed

4 files changed

+84
-25
lines changed

internal/e2e/rollup/BUILD.bazel

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ rollup_bundle(
1818

1919
jasmine_node_test(
2020
name = "test",
21-
srcs = glob(["*.spec.js"]),
21+
srcs = ["rollup.spec.js"],
2222
configuration_env_vars = ["UPDATE_GOLDEN"],
2323
data = glob([
2424
"*_golden.js_",
@@ -49,9 +49,9 @@ filegroup(
4949
)
5050

5151
filegroup(
52-
name = "bundle-outputgroups-es5_min_debug",
52+
name = "bundle-outputgroups-es2015",
5353
srcs = [":bundle"],
54-
output_group = "es5_min_debug",
54+
output_group = "es2015",
5555
)
5656

5757
filegroup(
@@ -60,22 +60,23 @@ filegroup(
6060
output_group = "es5_min",
6161
)
6262

63+
filegroup(
64+
name = "bundle-outputgroups-es5_min_debug",
65+
srcs = [":bundle"],
66+
output_group = "es5_min_debug",
67+
)
68+
6369
jasmine_node_test(
6470
name = "test-outputgroups",
65-
srcs = glob(["*.spec.js"]),
66-
configuration_env_vars = ["UPDATE_GOLDEN"],
67-
data = glob([
68-
"*_golden.js_",
69-
"*_golden.js.map",
70-
]) + [
71+
srcs = ["outputgroups.spec.js"],
72+
data = [
7173
":bundle-outputgroups-cjs",
7274
":bundle-outputgroups-umd",
75+
":bundle-outputgroups-es2015",
7376
":bundle-outputgroups-es5_min",
7477
":bundle-outputgroups-es5_min_debug",
7578
],
7679
deps = [
77-
"//internal/e2e:check_lib",
7880
"@npm//jasmine",
79-
"@npm//unidiff",
8081
],
8182
)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
function checkExists(name) {
5+
if (!fs.existsSync(path.join(__dirname, name))) {
6+
fail(`Output ${name} does not exist.`);
7+
}
8+
}
9+
10+
// TODO: the right assertions are to load up the source-map library
11+
// and assert that the sourcemap actually maps back to the sources
12+
13+
describe('outputgroups', () => {
14+
it('should produce a es2015 sourcemap', () => {
15+
checkExists('bundle.es2015.js');
16+
checkExists('bundle.es2015.js.map');
17+
});
18+
it('should produce a es5_min sourcemap', () => {
19+
checkExists('bundle.min.js');
20+
checkExists('bundle.min.js.map');
21+
});
22+
it('should produce a es5_min_debug sourcemap', () => {
23+
checkExists('bundle.min_debug.js');
24+
checkExists('bundle.min_debug.js.map');
25+
});
26+
it('should produce a cjs sourcemap', () => {
27+
checkExists('bundle.cjs.js');
28+
checkExists('bundle.cjs.js.map');
29+
});
30+
it('should produce a umd sourcemap', () => {
31+
checkExists('bundle.umd.js');
32+
checkExists('bundle.umd.js.map');
33+
});
34+
});

internal/e2e/rollup_code_splitting/BUILD.bazel

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ rollup_bundle(
1313

1414
jasmine_node_test(
1515
name = "test",
16-
srcs = glob(["*.spec.js"]),
16+
srcs = ["additional_entry.spec.js", "main1.spec.js"],
1717
data = glob([
1818
"*_golden.js_",
1919
]) + [
@@ -33,12 +33,6 @@ filegroup(
3333
output_group = "es2015",
3434
)
3535

36-
filegroup(
37-
name = "bundle-outputgroups-es5",
38-
srcs = [":bundle"],
39-
output_group = "es5",
40-
)
41-
4236
filegroup(
4337
name = "bundle-outputgroups-es5_min",
4438
srcs = [":bundle"],
@@ -53,18 +47,13 @@ filegroup(
5347

5448
jasmine_node_test(
5549
name = "test-outputgroups",
56-
srcs = glob(["*.spec.js"]),
57-
data = glob([
58-
"*_golden.js_",
59-
]) + [
50+
srcs = ["outputgroups.spec.js"],
51+
data = [
6052
":bundle-outputgroups-es2015",
61-
":bundle-outputgroups-es5",
6253
":bundle-outputgroups-es5_min",
6354
":bundle-outputgroups-es5_min_debug",
6455
],
6556
deps = [
66-
"//internal/e2e:check_lib",
6757
"@npm//jasmine",
68-
"@npm//unidiff",
6958
],
7059
)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
function checkExists(name) {
5+
if (!fs.existsSync(path.join(__dirname, name))) {
6+
fail(`Output ${name} does not exist.`);
7+
}
8+
}
9+
10+
// TODO: the right assertions are to load up the source-map library
11+
// and assert that the sourcemap actually maps back to the sources
12+
13+
describe('outputgroups', () => {
14+
it('should produce a es2015 sourcemap', () => {
15+
checkExists('bundle.es2015.js');
16+
checkExists('bundle_chunks_es2015/additional_entry.js');
17+
checkExists('bundle_chunks_es2015/additional_entry.js.map');
18+
checkExists('bundle_chunks_es2015/main1.js');
19+
checkExists('bundle_chunks_es2015/main1.js.map');
20+
});
21+
it('should produce a es5_min sourcemap', () => {
22+
checkExists('bundle.min.js');
23+
checkExists('bundle_chunks_min/additional_entry.js');
24+
checkExists('bundle_chunks_min/additional_entry.js.map');
25+
checkExists('bundle_chunks_min/main1.js');
26+
checkExists('bundle_chunks_min/main1.js.map');
27+
});
28+
it('should produce a es5_min_debug sourcemap', () => {
29+
checkExists('bundle.min_debug.js');
30+
checkExists('bundle_chunks_min_debug/additional_entry.js');
31+
checkExists('bundle_chunks_min_debug/additional_entry.js.map');
32+
checkExists('bundle_chunks_min_debug/main1.js');
33+
checkExists('bundle_chunks_min_debug/main1.js.map');
34+
});
35+
});

0 commit comments

Comments
 (0)