-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add fs option, fix validation test (#1818) * adding some more tests * sort and normalize options
- Loading branch information
Showing
64 changed files
with
3,884 additions
and
281 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
'use strict'; | ||
|
||
const ValidationError = require('schema-utils/src/ValidationError'); | ||
const webpack = require('webpack'); | ||
const Server = require('../../lib/Server'); | ||
const config = require('../fixtures/simple-config/webpack.config'); | ||
|
||
describe('Validation', () => { | ||
let compiler; | ||
let server; | ||
|
||
beforeAll(() => { | ||
compiler = webpack(config); | ||
}); | ||
|
||
describe('after', () => { | ||
beforeEach(() => { | ||
server = null; | ||
}); | ||
afterEach((done) => { | ||
if (server) { | ||
server.close(() => { | ||
done(); | ||
}); | ||
} else { | ||
done(); | ||
} | ||
}); | ||
|
||
it('should allow after to be function', () => { | ||
let error = null; | ||
try { | ||
const after = () => {}; | ||
|
||
server = new Server(compiler, { after }); | ||
} catch (err) { | ||
error = err; | ||
} | ||
expect(error).toBe(null); | ||
}); | ||
|
||
it('should not allow after to be the wrong type', () => { | ||
let error = null; | ||
try { | ||
server = new Server(compiler, { after: false }); | ||
} catch (err) { | ||
error = err; | ||
} | ||
expect(error).toBeInstanceOf(ValidationError); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.