This repository has been archived by the owner on Jul 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for 'webpack.config.extend.prod' and 'webpack.config.extend…
….dev'
- Loading branch information
t-kelly
committed
Sep 10, 2018
1 parent
ef039d8
commit 6db7b5d
Showing
4 changed files
with
54 additions
and
4 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
packages/slate-tools/tools/webpack/config/__tests__/dev.test.js
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,25 @@ | ||
test(`merges contents of 'webpack.config.extend.dev' into webpack config`, () => { | ||
global.slateUserConfig = { | ||
'webpack.config.extend.dev': {some: 'value'}, | ||
}; | ||
|
||
jest.mock('../core', () => { | ||
return {entry: {}}; | ||
}); | ||
jest.mock('webpack-merge'); | ||
jest.mock('../../entrypoints', () => { | ||
return { | ||
templateFiles: jest.fn(), | ||
layoutFiles: jest.fn(), | ||
}; | ||
}); | ||
|
||
const merge = require('webpack-merge'); | ||
const config = require('../dev'); | ||
|
||
expect(merge).toBeCalledWith( | ||
expect.arrayContaining([ | ||
global.slateUserConfig['webpack.config.extend.dev'], | ||
]), | ||
); | ||
}); |
25 changes: 25 additions & 0 deletions
25
packages/slate-tools/tools/webpack/config/__tests__/prod.test.js
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,25 @@ | ||
test(`merges contents of 'webpack.config.extend.prod' into webpack config`, () => { | ||
global.slateUserConfig = { | ||
'webpack.config.extend.prod': {some: 'value'}, | ||
}; | ||
|
||
jest.mock('../core', () => { | ||
return {entry: {}}; | ||
}); | ||
jest.mock('webpack-merge'); | ||
jest.mock('../../entrypoints', () => { | ||
return { | ||
templateFiles: jest.fn(), | ||
layoutFiles: jest.fn(), | ||
}; | ||
}); | ||
|
||
const merge = require('webpack-merge'); | ||
const config = require('../prod'); | ||
|
||
expect(merge).toBeCalledWith( | ||
expect.arrayContaining([ | ||
global.slateUserConfig['webpack.config.extend.prod'], | ||
]), | ||
); | ||
}); |
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