Skip to content

Commit 6a6968d

Browse files
committed
Code style fixes
1 parent fe5a8b5 commit 6a6968d

File tree

2 files changed

+46
-44
lines changed

2 files changed

+46
-44
lines changed

test/__snapshots__/loader.test.js.snap

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
exports[`Loader Default 1`] = `"module.exports = \\"a { color: black }\\\\n\\""`;
44

5-
exports[`Loader Watching Default 1`] = `"module.exports = \\"a { color: black }\\\\n\\""`;
5+
exports[`Loader Watching Dependencies Error 1`] = `"module.exports = \\"a { color: black }\\\\n\\""`;
66

7-
exports[`Loader Watching Default 2`] = `"throw new Error(\\"Module build failed: Syntax Error \\\\n\\\\n(1:5) Unknown word\\\\n\\\\n\\\\u001b[31m\\\\u001b[1m>\\\\u001b[22m\\\\u001b[39m\\\\u001b[90m 1 | \\\\u001b[39ma \\\\u001b[33m{\\\\u001b[39m color black \\\\u001b[33m}\\\\u001b[39m\\\\n \\\\u001b[90m | \\\\u001b[39m \\\\u001b[31m\\\\u001b[1m^\\\\u001b[22m\\\\u001b[39m\\\\n \\\\u001b[90m 2 | \\\\u001b[39m\\\\n\\");"`;
7+
exports[`Loader Watching Dependencies Error 2`] = `"throw new Error(\\"Module build failed: Syntax Error \\\\n\\\\n(1:5) Unknown word\\\\n\\\\n\\\\u001b[31m\\\\u001b[1m>\\\\u001b[22m\\\\u001b[39m\\\\u001b[90m 1 | \\\\u001b[39ma \\\\u001b[33m{\\\\u001b[39m color black \\\\u001b[33m}\\\\u001b[39m\\\\n \\\\u001b[90m | \\\\u001b[39m \\\\u001b[31m\\\\u001b[1m^\\\\u001b[22m\\\\u001b[39m\\\\n \\\\u001b[90m 2 | \\\\u001b[39m\\\\n\\");"`;
88
9-
exports[`Loader Watching Default 3`] = `"module.exports = \\"a { color: black }\\\\n\\""`;
9+
exports[`Loader Watching Dependencies Error 3`] = `"module.exports = \\"a { color: black }\\\\n\\""`;

test/loader.test.js

+43-41
Original file line numberDiff line numberDiff line change
@@ -23,63 +23,65 @@ describe('Loader', () => {
2323
})
2424

2525
describe('Watching', () => {
26-
const files = {
27-
syntaxError: "watch/watching/syntaxError.css",
28-
noSyntaxError: "watch/watching/noSyntaxError.css",
29-
changingFile: "watch/watching/styleDep.css"
30-
}
26+
describe('Dependencies', () => {
27+
const files = {
28+
syntaxError: "watch/watching/syntaxError.css",
29+
noSyntaxError: "watch/watching/noSyntaxError.css",
30+
changingFile: "watch/watching/styleDep.css"
31+
}
3132

32-
beforeAll(() => copyFile(files.noSyntaxError, files.changingFile))
33+
beforeEach(() => copyFile(files.noSyntaxError, files.changingFile))
3334

34-
afterAll(() => deleteFile(files.changingFile))
35+
afterEach(() => deleteFile(files.changingFile))
3536

36-
test('Default', () => {
37-
const config = {
38-
loader: {
39-
options: {
40-
plugins: [require("postcss-import")],
37+
test('Error', () => {
38+
const config = {
39+
loader: {
40+
options: {
41+
plugins: [require("postcss-import")],
42+
}
4143
}
4244
}
43-
}
4445

45-
const steps = [
46-
(stats) => {
47-
const { err, src } = loader(stats)
46+
const steps = [
47+
(stats) => {
48+
const { err, src } = loader(stats)
4849

49-
expect(src).toMatchSnapshot()
50-
expect(err.length).toEqual(0)
50+
expect(src).toMatchSnapshot()
51+
expect(err.length).toEqual(0)
5152

52-
return copyFile(files.syntaxError, files.changingFile)
53-
},
54-
(stats) => {
55-
const { err, src } = loader(stats)
53+
return copyFile(files.syntaxError, files.changingFile)
54+
},
55+
(stats) => {
56+
const { err, src } = loader(stats)
5657

57-
expect(src).toMatchSnapshot()
58-
expect(err.length).toEqual(1)
58+
expect(src).toMatchSnapshot()
59+
expect(err.length).toEqual(1)
5960

60-
return copyFile(files.noSyntaxError, files.changingFile)
61-
},
62-
(stats, close) => {
63-
const { err, src } = loader(stats)
61+
return copyFile(files.noSyntaxError, files.changingFile)
62+
},
63+
(stats, close) => {
64+
const { err, src } = loader(stats)
6465

65-
expect(src).toMatchSnapshot()
66-
expect(src).toEqual("module.exports = \"a { color: black }\\n\"")
67-
expect(err.length).toEqual(0)
66+
expect(src).toMatchSnapshot()
67+
expect(src).toEqual("module.exports = \"a { color: black }\\n\"")
68+
expect(err.length).toEqual(0)
6869

69-
return close()
70-
}
71-
];
70+
return close()
71+
}
72+
];
7273

73-
var currentStep = 0
74+
var currentStep = 0
7475

75-
const options = {
76-
watch (err, stats, close) {
77-
steps[currentStep](stats, close)
78-
currentStep++
76+
const options = {
77+
watch (err, stats, close) {
78+
steps[currentStep](stats, close)
79+
currentStep++
80+
}
7981
}
80-
}
8182

82-
return webpack('watch/watching/index.js', config, options)
83+
return webpack('watch/watching/index.js', config, options)
84+
})
8385
})
8486
})
8587
})

0 commit comments

Comments
 (0)