-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsass-loader-interop.spec.js
85 lines (77 loc) · 2.73 KB
/
sass-loader-interop.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
describe("Running CssEntryPlugin and SassLoader for scss files", () => {
beforeEach(done => {
this.webpack = webpackTestFixture(jasmine)
.withCssEntryPlugin()
.config({
module: {
rules: [
{
test: /\.scss$/,
use: [
{
loader: "css-loader",
options: { sourceMap: true }
},
{
loader: "sass-loader",
options: { sourceMap: true }
}
]
}
]
}
})
.cleanOutput(done);
});
describe("configured with a shorthand single entry", () => {
beforeEach(() => {
this.webpack
.config({
entry: fixtures.scss.style1.path
});
});
describe("with loader default options", () => {
beforeEach(done => this.webpack.run(done));
beforeEach(() => expect(this.webpack).toSucceed());
it("generates a single css bundle with the compiled scss", () => {
expect(this.webpack).toOutput({
content: fixtures.scss.style1.content
});
});
it("generates the css bundle only", () => {
expect(this.webpack).toOutput({
fileCount: 1
});
});
});
describe("with loader source maps", () => {
beforeEach(done => {
this.webpack
.config({
devtool: "source-map"
})
.run(done);
});
beforeEach(() => expect(this.webpack).toSucceed());
it("generates a single css bundle with the compiled scss", () => {
expect(this.webpack).toOutput({
content: fixtures.scss.style1.content
});
});
it("generates a single css map for the bundle", () => {
expect(this.webpack).toOutput({
file: "main.bundle.css.map",
withContent: [
"styles/style1.scss",
"@extend"
]
});
});
it("generates the css bundle only", () => {
expect(this.webpack).toOutput({
fileCount: 2
});
});
});
});
});