-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🧪 test(none): improve @roots/bud-entrypoints coverage
- Loading branch information
1 parent
38e8844
commit 1ee7d01
Showing
6 changed files
with
55 additions
and
6 deletions.
There are no files selected for viewing
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
File renamed without changes.
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 |
---|---|---|
@@ -1,8 +1,43 @@ | ||
import Extension from '@roots/bud-entrypoints' | ||
import {describe, expect, it} from 'vitest' | ||
import type {Bud} from '@roots/bud-framework' | ||
|
||
import {factory} from '@repo/test-kit' | ||
import EntrypointsWebpackPlugin from '@roots/entrypoints-webpack-plugin' | ||
import {beforeEach, describe, expect, it, vi} from 'vitest' | ||
|
||
import BudEntrypoints from '../src/extension/index.js' | ||
import DefaultExport from '../src/index.js' | ||
|
||
describe(`@roots/bud-entrypoints`, () => { | ||
it(`should be constructable`, () => { | ||
expect(Extension).toBeInstanceOf(Function) | ||
let bud: Bud | ||
let entrypoints: BudEntrypoints | ||
|
||
beforeEach(async () => { | ||
bud = await factory() | ||
entrypoints = new BudEntrypoints(bud) | ||
}) | ||
|
||
it(`should be instantiable`, () => { | ||
expect(entrypoints).toBeInstanceOf(BudEntrypoints) | ||
}) | ||
|
||
it(`should have a default export`, () => { | ||
expect(DefaultExport).toBe(BudEntrypoints) | ||
}) | ||
|
||
it(`should have a plugin property`, () => { | ||
expect(entrypoints.plugin).toBe(EntrypointsWebpackPlugin) | ||
}) | ||
|
||
it(`should have expected default options`, () => { | ||
expect(entrypoints.options).toStrictEqual({ | ||
emitHtml: false, | ||
publicPath: bud.publicPath(), | ||
type: `object`, | ||
}) | ||
}) | ||
|
||
it(`should use the updated publicPath value if the publicPath is updated`, async () => { | ||
bud.setPublicPath(`test/`) | ||
expect(entrypoints.options?.publicPath).toBe(`test/`) | ||
}) | ||
}) |
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,12 @@ | ||
import {defineConfig} from 'vitest/config' | ||
|
||
export default defineConfig({ | ||
test: { | ||
coverage: { | ||
exclude: [`**/types/*.ts`], | ||
include: [`src/**/*.ts`], | ||
provider: `v8`, | ||
}, | ||
include: [`test/**/*.test.ts`, `test/**/*.test.tsx`], | ||
}, | ||
}) |
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