Skip to content

Commit

Permalink
add specs
Browse files Browse the repository at this point in the history
  • Loading branch information
pustovalov committed Jan 30, 2020
1 parent cc64ce7 commit dfb268d
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 0 deletions.
32 changes: 32 additions & 0 deletions packages/size-limit/test/__snapshots__/run.test.js.snap
Expand Up @@ -202,6 +202,22 @@ Check out docs for more complicated cases
"
`;

exports[`shows migration guide for npm users with size-limit config and without dependencies 1`] = `
"Install Size Limit preset depends on type of the project
For application, where you send JS bundle directly to users
npm install --save-dev @size-limit/preset-app
For frameworks, components and big libraries
npm install --save-dev @size-limit/preset-big-lib
For small (< 10 KB) libraries
npm install --save-dev @size-limit/preset-small-lib
Check out docs for more complicated cases
https://github.com/ai/size-limit/
You need to add size-limit dependency: npm install --save-dev size-limit
"
`;

exports[`shows migration guide for npm users, because of yarn 2 1`] = `
" WARN  You need to add size-limit dependency
In order for the plugins to work correctly
Expand Down Expand Up @@ -232,6 +248,22 @@ Check out docs for more complicated cases
"
`;

exports[`shows migration guide for yarn users with size-limit config and without dependencies 1`] = `
"Install Size Limit preset depends on type of the project
For application, where you send JS bundle directly to users
yarn add --dev @size-limit/preset-app
For frameworks, components and big libraries
yarn add --dev @size-limit/preset-big-lib
For small (< 10 KB) libraries
yarn add --dev @size-limit/preset-small-lib
Check out docs for more complicated cases
https://github.com/ai/size-limit/
You need to add size-limit dependency: yarn add --dev size-limit
"
`;

exports[`shows size-limit dependency warning 1`] = `""`;

exports[`shows webpack-related help 1`] = `
Expand Down
Empty file.
@@ -0,0 +1,12 @@
{
"name": "file",
"private": true,
"devDependencies": {},
"size-limit": [
{
"path": "index.js",
"limit": "1 KB",
"running": false
}
]
}
Empty file.
@@ -0,0 +1,12 @@
{
"name": "file",
"private": true,
"devDependencies": {},
"size-limit": [
{
"path": "index.js",
"limit": "1 KB",
"running": false
}
]
}
Empty file.
14 changes: 14 additions & 0 deletions packages/size-limit/test/run.test.js
Expand Up @@ -121,6 +121,20 @@ it('shows migration guide for yarn 2 users', async () => {
expect(history.stderr).toMatchSnapshot()
})

it('shows migration guide for yarn users: config 1, dep 0', async () => {
let [process, history] = createProcess('yarn-with-config-without-dev')
await run(process)
expect(history.exitCode).toEqual(1)
expect(history.stderr).toMatchSnapshot()
})

it('shows migration guide for npm users: config 1, dep 0', async () => {
let [process, history] = createProcess('npm-with-config-without-dev')
await run(process)
expect(history.exitCode).toEqual(1)
expect(history.stderr).toMatchSnapshot()
})

it('shows migration guide for npm users, because of yarn 2', async () => {
let [process, history] = createProcess('npm-without-dev-dep')
await run(process)
Expand Down

0 comments on commit dfb268d

Please sign in to comment.