Skip to content

Commit f13e95c

Browse files
committed
refactor: revert mode condition
1 parent 5a6083d commit f13e95c

2 files changed

Lines changed: 4 additions & 14 deletions

File tree

src/plugin.spec.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('DevcertPlugin', () => {
2121
const userConfig = { server: { https: { key: 'a', cert: 'b' } } };
2222

2323
// @ts-expect-error It's a test, so we can ignore type errors
24-
const result = await plugin.config(userConfig, { command: 'serve', mode: 'development' });
24+
const result = await plugin.config(userConfig, { command: 'serve' });
2525

2626
expect(warn).toHaveBeenCalledWith('! Skipping devcert, key and cert already provided.');
2727
expect(result).toBe(userConfig);
@@ -33,7 +33,7 @@ describe('DevcertPlugin', () => {
3333
const userConfig = { server: {} };
3434

3535
// @ts-expect-error It's a test, so we can ignore type errors
36-
const result = await plugin.config(userConfig, { command: 'serve', mode: 'development' });
36+
const result = await plugin.config(userConfig, { command: 'serve' });
3737

3838
expect(result?.server?.https?.key).toBe('mock-key');
3939
expect(result?.server?.https?.cert).toBe('mock-cert');
@@ -48,14 +48,4 @@ describe('DevcertPlugin', () => {
4848

4949
expect(result).toBeUndefined();
5050
});
51-
52-
it('does nothing if mode is not development', async () => {
53-
const plugin = DevcertPlugin();
54-
const userConfig = { server: {} };
55-
56-
// @ts-expect-error It's a test, so we can ignore type errors
57-
const result = await plugin.config(userConfig, { mode: 'production' });
58-
59-
expect(result).toBeUndefined();
60-
});
6151
});

src/plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export default function DevcertPlugin(options: PluginOptions = {}): Plugin {
2323

2424
return {
2525
name: '@idleberg/vite-plugin-devcert',
26-
config: async (userConfig: UserConfig, { command, mode }) => {
27-
if (command !== 'serve' || mode !== 'development') {
26+
config: async (userConfig: UserConfig, { command }) => {
27+
if (command !== 'serve') {
2828
return;
2929
}
3030

0 commit comments

Comments
 (0)