Skip to content

Commit 027c8ca

Browse files
committed
Update assertions used in tests for source maps.
Signed-off-by: Nick Petruzzelli <[email protected]>
1 parent 8cf05a9 commit 027c8ca

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

test/sourceMapTest.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ describe("source maps", function() {
4444
file: 'test.css',
4545
mappings: 'AAAA,SAAS,SAAS,EAAE',
4646
names: [],
47-
sourceRoot: '',
4847
sources: [ '/folder/test.css' ],
4948
sourcesContent: [ '.class { a: b c d; }' ],
5049
version: 3
@@ -70,7 +69,6 @@ describe("source maps", function() {
7069
file: 'test.css',
7170
mappings: 'AAAA,SAAS,SAAS,EAAE',
7271
names: [],
73-
sourceRoot: '',
7472
sources: [ '/folder/test.css' ],
7573
sourcesContent: [ '.class { a: b c d; }' ],
7674
version: 3
@@ -83,79 +81,79 @@ describe("source maps", function() {
8381
testMap("generate sourceMap (1 loader)", ".class { a: b c d; }", undefined, {
8482
loaders: [{request: "/path/css-loader"}],
8583
resource: "/folder/test.css",
84+
resourcePath: "/folder/test.css",
8685
request: "/path/css-loader!/folder/test.css",
8786
query: "?sourceMap"
8887
}, [
8988
[1, ".class { a: b c d; }", "", {
9089
file: 'test.css',
9190
mappings: 'AAAA,SAAS,SAAS,EAAE',
9291
names: [],
93-
sourceRoot: '',
94-
sources: [ '/folder/test.css' ],
92+
sources: [ 'test.css' ],
9593
sourcesContent: [ '.class { a: b c d; }' ],
9694
version: 3
9795
}]
9896
]);
9997
testMap("generate sourceMap (1 loader, relative)", ".class { a: b c d; }", undefined, {
10098
loaders: [{request: "/path/css-loader"}],
10199
resource: "/folder/test.css",
100+
resourcePath: "/folder/test.css",
102101
request: "/path/css-loader!/folder/test.css",
103102
query: "?sourceMap"
104103
}, [
105104
[1, ".class { a: b c d; }", "", {
106105
file: 'test.css',
107106
mappings: 'AAAA,SAAS,SAAS,EAAE',
108107
names: [],
109-
sourceRoot: '',
110-
sources: [ '/folder/test.css' ],
108+
sources: [ 'test.css' ],
111109
sourcesContent: [ '.class { a: b c d; }' ],
112110
version: 3
113111
}]
114112
]);
115113
testMap("generate sourceMap (1 loader, data url)", ".class { background-image: url(\"data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 42 26' fill='%23007aff'><rect width='4' height='4'/><rect x='8' y='1' width='34' height='2'/><rect y='11' width='4' height='4'/><rect x='8' y='12' width='34' height='2'/><rect y='22' width='4' height='4'/><rect x='8' y='23' width='34' height='2'/></svg>\"); }", undefined, {
116114
loaders: [{request: "/path/css-loader"}],
117115
resource: "/folder/test.css",
116+
resourcePath: "/folder/test.css",
118117
request: "/path/css-loader!/folder/test.css",
119118
query: "?sourceMap"
120119
}, [
121120
[1, ".class { background-image: url(\"data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 42 26' fill='%23007aff'><rect width='4' height='4'/><rect x='8' y='1' width='34' height='2'/><rect y='11' width='4' height='4'/><rect x='8' y='12' width='34' height='2'/><rect y='22' width='4' height='4'/><rect x='8' y='23' width='34' height='2'/></svg>\"); }", "", {
122121
file: 'test.css',
123122
mappings: 'AAAA,SAAS,6WAA6W,EAAE',
124123
names: [],
125-
sourceRoot: '',
126-
sources: [ '/folder/test.css' ],
124+
sources: [ 'test.css' ],
127125
sourcesContent: [ '.class { background-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 42 26\' fill=\'%23007aff\'><rect width=\'4\' height=\'4\'/><rect x=\'8\' y=\'1\' width=\'34\' height=\'2\'/><rect y=\'11\' width=\'4\' height=\'4\'/><rect x=\'8\' y=\'12\' width=\'34\' height=\'2\'/><rect y=\'22\' width=\'4\' height=\'4\'/><rect x=\'8\' y=\'23\' width=\'34\' height=\'2\'/></svg>"); }' ],
128126
version: 3
129127
}]
130128
]);
131129
testMap("generate sourceMap (1 loader, encoded data url)", ".class { background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2042%2026%27%20fill%3D%27%23007aff%27%3E%3Crect%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%271%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2711%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2712%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2722%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2723%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3C%2Fsvg%3E\"); }", undefined, {
132130
loaders: [{request: "/path/css-loader"}],
133131
resource: "/folder/test.css",
132+
resourcePath: "/folder/test.css",
134133
request: "/path/css-loader!/folder/test.css",
135134
query: "?sourceMap"
136135
}, [
137136
[1, ".class { background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2042%2026%27%20fill%3D%27%23007aff%27%3E%3Crect%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%271%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2711%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2712%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2722%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2723%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3C%2Fsvg%3E\"); }", "", {
138137
file: 'test.css',
139138
mappings: 'AAAA,SAAS,mmBAAmmB,EAAE',
140139
names: [],
141-
sourceRoot: '',
142-
sources: [ '/folder/test.css' ],
140+
sources: [ 'test.css' ],
143141
sourcesContent: [ '.class { background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2042%2026%27%20fill%3D%27%23007aff%27%3E%3Crect%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%271%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2711%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2712%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3Crect%20y%3D%2722%27%20width%3D%274%27%20height%3D%274%27%2F%3E%3Crect%20x%3D%278%27%20y%3D%2723%27%20width%3D%2734%27%20height%3D%272%27%2F%3E%3C%2Fsvg%3E"); }' ],
144142
version: 3
145143
}]
146144
]);
147145
testMap("generate sourceMap (2 loaders)", ".class { a: b c d; }", undefined, {
148146
loaders: [{request: "/path/css-loader"}, {request: "/path/sass-loader"}],
149147
resource: "/folder/test.scss",
148+
resourcePath: "/folder/test.scss",
150149
request: "/path/css-loader!/path/sass-loader!/folder/test.scss",
151150
query: "?sourceMap"
152151
}, [
153152
[1, ".class { a: b c d; }", "", {
154153
file: 'test.scss',
155154
mappings: 'AAAA,SAAS,SAAS,EAAE',
156155
names: [],
157-
sourceRoot: '',
158-
sources: [ '/folder/test.scss' ],
156+
sources: [ 'test.scss' ],
159157
sourcesContent: [ '.class { a: b c d; }' ],
160158
version: 3
161159
}]
@@ -165,21 +163,21 @@ describe("source maps", function() {
165163
mappings: 'AAAA,SAAS,SAAS,EAAE',
166164
names: [],
167165
sourceRoot: '',
168-
sources: [ '/folder/test.scss' ],
166+
sources: [ 'test.scss' ],
169167
sourcesContent: [ '.class { a: b c d; }' ],
170168
version: 3
171169
}, {
172170
loaders: [{request: "/path/css-loader"}, {request: "/path/sass-loader"}],
173171
resource: "/folder/test.scss",
172+
resourcePath: "/folder/test.scss",
174173
request: "/path/css-loader!/path/sass-loader!/folder/test.scss",
175174
query: "?sourceMap"
176175
}, [
177176
[1, ".class { a: b c d; }", "", {
178177
file: 'test.scss',
179178
mappings: 'AAAA,SAAS,SAAS,EAAE',
180179
names: [],
181-
sourceRoot: '',
182-
sources: [ '/folder/test.scss' ],
180+
sources: [ 'test.scss' ],
183181
sourcesContent: [ '.class { a: b c d; }' ],
184182
version: 3
185183
}]

0 commit comments

Comments
 (0)