Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

Commit 46ba033

Browse files
committed
refactor e2e spec a little
1 parent db73743 commit 46ba033

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

test/e2e/e2e_spec.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@ const snapshot = require('snap-shot-it')
44
const fs = require('../../fs')
55
const preprocessor = require('../../index')
66

7-
describe('browserify preprocessor - e2e', function () {
8-
const on = () => {}
9-
10-
beforeEach(function () {
11-
fs.removeSync(path.join(__dirname, '_test-output'))
12-
})
7+
beforeEach(function () {
8+
fs.removeSync(path.join(__dirname, '_test-output'))
9+
})
1310

14-
it('correctly preprocesses the file', function () {
15-
const filePath = path.join(__dirname, '..', 'fixtures', 'example_spec.js')
11+
const bundle = (fixtureName) => {
12+
const on = () => {}
13+
const filePath = path.join(__dirname, '..', 'fixtures', fixtureName)
1614
const outputPath = path.join(__dirname, '..', '_test-output', 'output.js')
1715
return preprocessor()({ filePath, outputPath, on }).then(() => {
18-
snapshot(fs.readFileSync(outputPath).toString())
16+
return fs.readFileSync(outputPath).toString()
17+
})
18+
}
19+
20+
describe('browserify preprocessor - e2e', function () {
21+
it('correctly preprocesses the file', function () {
22+
return bundle('example_spec.js').then(output => {
23+
snapshot(output)
1924
})
2025
})
2126
})

0 commit comments

Comments
 (0)