Skip to content

Commit 5031d30

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

File tree

4 files changed

+88
-26
lines changed

4 files changed

+88
-26
lines changed

internal/e2e/rollup/BUILD.bazel

Lines changed: 13 additions & 12 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",
72-
":bundle-outputgroups-umd",
74+
":bundle-outputgroups-es2015",
7375
":bundle-outputgroups-es5_min",
7476
":bundle-outputgroups-es5_min_debug",
77+
":bundle-outputgroups-umd",
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: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ rollup_bundle(
1313

1414
jasmine_node_test(
1515
name = "test",
16-
srcs = glob(["*.spec.js"]),
16+
srcs = [
17+
"additional_entry.spec.js",
18+
"main1.spec.js",
19+
],
1720
data = glob([
1821
"*_golden.js_",
1922
]) + [
@@ -33,12 +36,6 @@ filegroup(
3336
output_group = "es2015",
3437
)
3538

36-
filegroup(
37-
name = "bundle-outputgroups-es5",
38-
srcs = [":bundle"],
39-
output_group = "es5",
40-
)
41-
4239
filegroup(
4340
name = "bundle-outputgroups-es5_min",
4441
srcs = [":bundle"],
@@ -53,18 +50,13 @@ filegroup(
5350

5451
jasmine_node_test(
5552
name = "test-outputgroups",
56-
srcs = glob(["*.spec.js"]),
57-
data = glob([
58-
"*_golden.js_",
59-
]) + [
53+
srcs = ["outputgroups.spec.js"],
54+
data = [
6055
":bundle-outputgroups-es2015",
61-
":bundle-outputgroups-es5",
6256
":bundle-outputgroups-es5_min",
6357
":bundle-outputgroups-es5_min_debug",
6458
],
6559
deps = [
66-
"//internal/e2e:check_lib",
6760
"@npm//jasmine",
68-
"@npm//unidiff",
6961
],
7062
)
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)