-
-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
don't use loaders in SourceMaps, just the resource
fixed #154
- Loading branch information
Showing
4 changed files
with
73 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,64 @@ | ||
/*globals describe */ | ||
|
||
var testWithMap = require("./helpers").testWithMap; | ||
var testMap = require("./helpers").testMap; | ||
|
||
describe("falsy source maps", function() { | ||
testWithMap("null map doesn't cause an error", ".class { a: b c d; }", null, [ | ||
describe("source maps", function() { | ||
testWithMap("falsy: null map doesn't cause an error", ".class { a: b c d; }", null, [ | ||
[1, ".class { a: b c d; }", ""] | ||
]); | ||
testWithMap("undefined map doesn't cause an error", ".class { a: b c d; }", undefined, [ | ||
testWithMap("falsy: undefined map doesn't cause an error", ".class { a: b c d; }", undefined, [ | ||
[1, ".class { a: b c d; }", ""] | ||
]); | ||
testMap("generate sourceMap (1 loader)", ".class { a: b c d; }", undefined, { | ||
loaders: [{request: "/path/css-loader"}], | ||
options: { context: "/" }, | ||
resource: "/folder/test.css", | ||
request: "/path/css-loader!/folder/test.css", | ||
query: "?sourceMap" | ||
}, [ | ||
[1, ".class { a: b c d; }", "", { | ||
file: 'test.css', | ||
mappings: 'AAAA,SAAS,SAAS,EAAE', | ||
names: [], | ||
sourceRoot: 'webpack://', | ||
sources: [ '/./folder/test.css' ], | ||
sourcesContent: [ '.class { a: b c d; }' ], | ||
version: 3 | ||
}] | ||
]); | ||
testMap("generate sourceMap (1 loader, relative)", ".class { a: b c d; }", undefined, { | ||
loaders: [{request: "/path/css-loader"}], | ||
options: { context: "/other-folder/sub" }, | ||
resource: "/folder/test.css", | ||
request: "/path/css-loader!/folder/test.css", | ||
query: "?sourceMap" | ||
}, [ | ||
[1, ".class { a: b c d; }", "", { | ||
file: 'test.css', | ||
mappings: 'AAAA,SAAS,SAAS,EAAE', | ||
names: [], | ||
sourceRoot: 'webpack://', | ||
sources: [ '/../../folder/test.css' ], | ||
sourcesContent: [ '.class { a: b c d; }' ], | ||
version: 3 | ||
}] | ||
]); | ||
testMap("generate sourceMap (2 loaders)", ".class { a: b c d; }", undefined, { | ||
loaders: [{request: "/path/css-loader"}, {request: "/path/sass-loader"}], | ||
options: { context: "/" }, | ||
resource: "/folder/test.scss", | ||
request: "/path/css-loader!/path/sass-loader!/folder/test.scss", | ||
query: "?sourceMap" | ||
}, [ | ||
[1, ".class { a: b c d; }", "", { | ||
file: 'test.scss', | ||
mappings: 'AAAA,SAAS,SAAS,EAAE', | ||
names: [], | ||
sourceRoot: 'webpack://', | ||
sources: [ '/./folder/test.scss' ], | ||
sourcesContent: [ '.class { a: b c d; }' ], | ||
version: 3 | ||
}] | ||
]); | ||
}); |