Skip to content

Commit

Permalink
fix strict null error in getChromiumChannelsFromEnv
Browse files Browse the repository at this point in the history
  • Loading branch information
mnholtz committed Aug 8, 2024
1 parent 215393b commit 0efbd59
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion end-to-end-tests/fixtures/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import { type BrowserContext, chromium } from "@playwright/test";
import { CI, PWDEBUG, SLOWMO } from "../env";
import path from "node:path";
import { SupportedChannel } from "../../playwright.config";

Check failure on line 21 in end-to-end-tests/fixtures/utils.ts

View workflow job for this annotation

GitHub Actions / lint

All imports in the declaration are only used as types. Use `import type`

export const launchPersistentContextWithExtension = async (
chromiumChannel: "chrome" | "msedge",
Expand Down Expand Up @@ -67,7 +68,7 @@ export const getExtensionId = async (context: BrowserContext) => {

export const getAuthProfilePathFile = (
profileName: string,
chromiumChannel: "chrome" | "msedge",
chromiumChannel: SupportedChannel,
) =>
path.join(
__dirname,
Expand Down
11 changes: 7 additions & 4 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ export const SupportedChannels: Record<

export type SupportedChannel = ValueOf<typeof SupportedChannels>;

const channels: SupportedChannel[] = (() => {
const getChromiumChannelsFromEnv = (): SupportedChannel[] => {
if (!E2E_CHROMIUM_CHANNELS) {
return [SupportedChannels.CHROME, SupportedChannels.MSEDGE];
return [
SupportedChannels.CHROME,
SupportedChannels.MSEDGE,
] as SupportedChannel[];
}

let parsedChannels: unknown;
Expand Down Expand Up @@ -49,7 +52,7 @@ const channels: SupportedChannel[] = (() => {

return parsedChannel as SupportedChannel;
});
})();
};

/**
* See https://playwright.dev/docs/test-configuration.
Expand Down Expand Up @@ -96,7 +99,7 @@ export default defineConfig<{ chromiumChannel: string }>({
navigationTimeout: 10_000,
},
/* Configure projects for major browsers */
projects: channels.flatMap((chromiumChannel) => [
projects: getChromiumChannelsFromEnv().flatMap((chromiumChannel) => [
{
name: `${chromiumChannel}-setup`,
use:
Expand Down

0 comments on commit 0efbd59

Please sign in to comment.