Skip to content

Commit

Permalink
feat: Allow performance.hints in webpack config (#150)
Browse files Browse the repository at this point in the history
* feat: Allow performance.hints in webpack config

Webpack 2.1.0-beta.28 adds `performance.hints` (which take boolean
values) as a way to enable/disable performance warnings. (The first
performance warning is about bundle size.)

* fix: Fix name of an import

The test file for the `performance` property should import the test utils module using `utils` in

lowercase but instead imported `Utils` in uppercase. This worked fine on my machine because my

filesystem is case-insensitive but fails in Travis because its filesystem is case-sensitive.
  • Loading branch information
huy-nguyen authored and Kent C. Dodds committed Dec 15, 2016
1 parent fd3b40d commit fbfd616
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import resolveSchemaFn from './properties/resolve'
import outputSchema from './properties/output'
import watchOptionsSchema from './properties/watchOptions'
import devServerSchema from './properties/devServer'
import performanceSchema from './properties/performance'
import { looksLikeAbsolutePath } from './types'
import _merge from 'lodash/merge'
import sh from 'shelljs'
Expand Down Expand Up @@ -55,6 +56,7 @@ function makeSchema(schemaOptions, schemaExtension) {
})),
watch: Joi.boolean(),
watchOptions: watchOptionsSchema,
performance: performanceSchema,
stats: Joi.any(), // TODO
target: Joi.any(), // TODO

Expand Down
5 changes: 5 additions & 0 deletions src/properties/performance/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Joi from 'joi'

export default Joi.object({
hints: Joi.boolean(),
})
11 changes: 11 additions & 0 deletions src/properties/performance/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import schema from './index'
import { allValid } from '../../../test/utils'

const validPerformanceConfigs = [
{ input: { hints: true } },
{ input: { hints: false } },
]

describe('performance', () => {
allValid(validPerformanceConfigs, schema)
})

0 comments on commit fbfd616

Please sign in to comment.