mirror of
https://github.com/vitejs/vite.git
synced 2024-11-21 14:48:41 +00:00
test: reinstate pluginContainer.spec.ts tests
This commit is contained in:
parent
649a5c2c07
commit
004a25db3a
@ -52,7 +52,6 @@ describe('plugin container', () => {
|
||||
},
|
||||
}
|
||||
|
||||
/*
|
||||
const container = await getPluginContainer({
|
||||
plugins: [plugin],
|
||||
})
|
||||
@ -67,7 +66,6 @@ describe('plugin container', () => {
|
||||
await container.close()
|
||||
|
||||
expect(metaArray).toEqual([{ x: 1 }, { x: 2 }, { x: 3 }])
|
||||
*/
|
||||
})
|
||||
|
||||
it('can pass metadata between plugins', async () => {
|
||||
@ -93,7 +91,6 @@ describe('plugin container', () => {
|
||||
},
|
||||
}
|
||||
|
||||
/*
|
||||
const container = await getPluginContainer({
|
||||
plugins: [plugin1, plugin2],
|
||||
})
|
||||
@ -102,7 +99,6 @@ describe('plugin container', () => {
|
||||
await container.load(entryUrl)
|
||||
|
||||
expect.assertions(1)
|
||||
*/
|
||||
})
|
||||
|
||||
it('can pass custom resolve opts between plugins', async () => {
|
||||
@ -141,7 +137,6 @@ describe('plugin container', () => {
|
||||
},
|
||||
}
|
||||
|
||||
/*
|
||||
const container = await getPluginContainer({
|
||||
plugins: [plugin1, plugin2],
|
||||
})
|
||||
@ -150,7 +145,6 @@ describe('plugin container', () => {
|
||||
await container.load(entryUrl)
|
||||
|
||||
expect.assertions(2)
|
||||
*/
|
||||
})
|
||||
})
|
||||
|
||||
@ -182,7 +176,6 @@ describe('plugin container', () => {
|
||||
},
|
||||
}
|
||||
|
||||
/*
|
||||
const container = await getPluginContainer({
|
||||
plugins: [plugin],
|
||||
})
|
||||
@ -190,7 +183,6 @@ describe('plugin container', () => {
|
||||
const loadResult: any = await container.load(entryUrl)
|
||||
const result: any = await container.transform(loadResult.code, entryUrl)
|
||||
expect(result.code).equals('2')
|
||||
*/
|
||||
})
|
||||
|
||||
it('will load and transform the module', async () => {
|
||||
@ -216,7 +208,6 @@ describe('plugin container', () => {
|
||||
},
|
||||
}
|
||||
|
||||
/* TODO
|
||||
const container = await getPluginContainer({
|
||||
plugins: [plugin],
|
||||
})
|
||||
@ -224,12 +215,10 @@ describe('plugin container', () => {
|
||||
const loadResult: any = await container.load(entryUrl)
|
||||
const result: any = await container.transform(loadResult.code, entryUrl)
|
||||
expect(result.code).equals('3')
|
||||
*/
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
/* TODO
|
||||
async function getPluginContainer(
|
||||
inlineConfig?: UserConfig,
|
||||
): Promise<PluginContainer> {
|
||||
@ -242,7 +231,14 @@ async function getPluginContainer(
|
||||
config.plugins = config.plugins.filter((p) => !p.name.includes('pre-alias'))
|
||||
|
||||
resolveId = (id) => container.resolveId(id)
|
||||
const container = await createPluginContainer(config, getModuleGraph)
|
||||
const container = await createPluginContainer(
|
||||
config,
|
||||
(environment: string) => {
|
||||
if (environment === 'browser') {
|
||||
return moduleGraph
|
||||
}
|
||||
throw new Error('unexpected environment')
|
||||
},
|
||||
)
|
||||
return container
|
||||
}
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user