chore: update dependencies to rollup 4 and remove unneeded dependencies
This commit is contained in:
@@ -2,8 +2,8 @@ import {Plugin, InputPluginOption, RollupOptions, OutputOptions, RollupOutput} f
|
||||
import {TestOptions as BrowserTestOptions, TestOutput as PuppeteerTestOutput} from "./puppeteer-run-test.js";
|
||||
import { rollup } from "rollup";
|
||||
import serveTest, {LogCallback} from "./serve-test.ts";
|
||||
import type {ExecutionContext} from "ava";
|
||||
import {getCode, TestOutput} from "./code-output.ts";
|
||||
import {defaultOutput} from "./default-output.ts";
|
||||
|
||||
export interface OutputFilterOptions {
|
||||
html?: boolean
|
||||
@@ -56,17 +56,11 @@ export async function runBrowserTest(
|
||||
});
|
||||
|
||||
// TODO make configurable?
|
||||
const generated = await bundle.generate({
|
||||
dir: 'output', // Output all files
|
||||
format: 'es', // iifi and cjs should be added to tests
|
||||
sourcemap: true,// Test if #sourcemapUrl is not accidentally included in the html-output
|
||||
chunkFileNames: '[name].js',
|
||||
entryFileNames: '[name].mjs',
|
||||
assetFileNames: '[name].[extname]',
|
||||
});
|
||||
|
||||
if(output){
|
||||
testOutput.code = await getCode(bundle, output);
|
||||
testOutput.code = await getCode(bundle);
|
||||
}else{
|
||||
const generated = await bundle.generate(defaultOutput);
|
||||
}
|
||||
await bundle.close();
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type {RollupBuild, OutputOptions, OutputAsset, OutputChunk, SourceMap} from "rollup";
|
||||
import {defaultOutput} from "./default-output.ts";
|
||||
|
||||
export interface TestOutput{
|
||||
code: string,
|
||||
@@ -7,7 +8,7 @@ export interface TestOutput{
|
||||
map: any
|
||||
}
|
||||
|
||||
export const getCode = async (bundle: RollupBuild, outputOptions: OutputOptions): Promise<TestOutput[]> => {
|
||||
export const getCode = async (bundle: RollupBuild, outputOptions: OutputOptions = defaultOutput): Promise<TestOutput[]> => {
|
||||
const { output } = await bundle.generate(outputOptions || { format: 'cjs', exports: 'auto' });
|
||||
|
||||
return output.sort((a,b)=> {
|
||||
|
||||
11
test/util/default-output.ts
Normal file
11
test/util/default-output.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import type {OutputOptions} from "rollup";
|
||||
|
||||
export const defaultOutput : OutputOptions = {
|
||||
dir: 'output', // Output all files
|
||||
format: 'es', // iifi and cjs should be added to tests
|
||||
sourcemap: true,// Test if #sourcemapUrl is not accidentally included in the html-output
|
||||
// Prevent hashes from being added (and screw up the snapshots)
|
||||
chunkFileNames: '[name].js',
|
||||
entryFileNames: '[name].js',
|
||||
assetFileNames: '[name].[extname]',
|
||||
};
|
||||
@@ -28,9 +28,6 @@ import type {
|
||||
} from 'http'
|
||||
import type { ServerOptions } from 'https'
|
||||
|
||||
import test, {ExecutionContext} from "ava";
|
||||
import {createReadStream} from "fs";
|
||||
|
||||
|
||||
type TypeMap = {
|
||||
[key: string]: string[];
|
||||
|
||||
Reference in New Issue
Block a user