Unverified Commit b9124923 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

Turbopack: import webpack loader rules conditions (#64205)

### What?

* remove custom next-* conditions
* add `foreign` condition
* allow `false` in turbo.rules
* improve schema for turbo.rules

### Why?

### How?



Closes PACK-2913

---------
Co-authored-by: 's avatarTim Neutkens <tim@timneutkens.nl>
parent 265d7b97
......@@ -6,7 +6,6 @@
pub mod app_segment_config;
pub mod app_structure;
mod babel;
mod bootstrap;
mod embed_js;
mod emit;
......@@ -33,7 +32,6 @@ mod next_shared;
pub mod next_telemetry;
mod page_loader;
pub mod pages_structure;
mod sass;
pub mod tracing_presets;
mod transform_options;
pub mod url_node;
......
use std::iter::once;
use anyhow::Result;
use indexmap::IndexMap;
use turbo_tasks::{Value, Vc};
......@@ -25,7 +27,6 @@ use turbopack_binding::{
module_options::{
module_options_context::ModuleOptionsContext, JsxTransformOptions,
MdxTransformModuleOptions, ModuleRule, TypescriptTransformOptions,
WebpackLoadersOptions,
},
resolve_options_context::ResolveOptionsContext,
},
......@@ -34,10 +35,9 @@ use turbopack_binding::{
use super::transforms::get_next_client_transforms_rules;
use crate::{
babel::maybe_add_babel_loader,
embed_js::next_js_fs,
mode::NextMode,
next_build::{get_external_next_compiled_package_mapping, get_postcss_package_mapping},
next_build::get_postcss_package_mapping,
next_client::runtime_entry::{RuntimeEntries, RuntimeEntry},
next_config::NextConfig,
next_import_map::{
......@@ -55,8 +55,8 @@ use crate::{
styled_jsx::get_styled_jsx_transform_rule,
swc_ecma_transform_plugins::get_swc_ecma_transform_plugin_rule,
},
webpack_rules::webpack_loader_options,
},
sass::maybe_add_sass_loader,
transform_options::{
get_decorators_transform_options, get_jsx_transform_options,
get_typescript_transform_options,
......@@ -134,17 +134,6 @@ pub enum ClientContextType {
Other,
}
impl ClientContextType {
pub fn conditions(&self) -> &'static [&'static str] {
match self {
ClientContextType::Pages { .. } => &["next-client", "next-pages"],
ClientContextType::App { .. } => &["next-client", "next-app"],
ClientContextType::Fallback => &["next-client", "next-fallback"],
ClientContextType::Other => &["next-client", "next-other"],
}
}
}
#[turbo_tasks::function]
pub async fn get_client_resolve_options_context(
project_path: Vc<FileSystemPath>,
......@@ -158,8 +147,7 @@ pub async fn get_client_resolve_options_context(
let next_client_fallback_import_map = get_next_client_fallback_import_map(ty);
let next_client_resolved_map =
get_next_client_resolved_map(project_path, project_path, *mode.await?);
let mut custom_conditions = vec![mode.await?.condition().to_string()];
custom_conditions.extend(ty.conditions().iter().map(ToString::to_string));
let custom_conditions = vec![mode.await?.condition().to_string()];
let module_options_context = ResolveOptionsContext {
enable_node_modules: Some(project_path.root().resolve().await?),
custom_conditions,
......@@ -226,33 +214,22 @@ pub async fn get_client_module_options_context(
// foreign_code_context_condition. This allows to import codes from
// node_modules that requires webpack loaders, which next-dev implicitly
// does by default.
let mut conditions = vec!["browser".to_string(), mode.await?.condition().to_string()];
conditions.extend(ty.conditions().iter().map(ToString::to_string));
let foreign_webpack_rules = *next_config.webpack_rules(conditions).await?;
let foreign_webpack_rules =
maybe_add_sass_loader(next_config.sass_config(), foreign_webpack_rules).await?;
let foreign_webpack_loaders = foreign_webpack_rules.map(|rules| {
WebpackLoadersOptions {
rules,
loader_runner_package: Some(get_external_next_compiled_package_mapping(Vc::cell(
"loader-runner".to_owned(),
))),
}
.cell()
});
let conditions = vec!["browser".to_string(), mode.await?.condition().to_string()];
let foreign_enable_webpack_loaders = webpack_loader_options(
project_path,
next_config,
true,
conditions
.iter()
.cloned()
.chain(once("foreign".to_string()))
.collect(),
)
.await?;
// Now creates a webpack rules that applies to all codes.
let webpack_rules = *foreign_webpack_rules.clone();
let webpack_rules = *maybe_add_babel_loader(project_path, webpack_rules).await?;
let enable_webpack_loaders = webpack_rules.map(|rules| {
WebpackLoadersOptions {
rules,
loader_runner_package: Some(get_external_next_compiled_package_mapping(Vc::cell(
"loader-runner".to_owned(),
))),
}
.cell()
});
let enable_webpack_loaders =
webpack_loader_options(project_path, next_config, false, conditions).await?;
let use_swc_css = *next_config.use_swc_css().await?;
let target_browsers = env.runtime_versions();
......@@ -299,7 +276,7 @@ pub async fn get_client_module_options_context(
// node_modules context
let foreign_codes_options_context = ModuleOptionsContext {
enable_webpack_loaders: foreign_webpack_loaders,
enable_webpack_loaders: foreign_enable_webpack_loaders,
enable_postcss_transform: enable_foreign_postcss_transform,
custom_rules: foreign_next_client_rules,
// NOTE(WEB-1016) PostCSS transforms should also apply to foreign code.
......
......@@ -414,6 +414,7 @@ pub enum RuleConfigItemOrShortcut {
pub enum RuleConfigItem {
Options(RuleConfigItemOptions),
Conditional(IndexMap<String, RuleConfigItem>),
Boolean(bool),
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, TraceRawVcs)]
......@@ -736,25 +737,35 @@ impl NextConfig {
.collect(),
)
}
enum FindRuleResult<'a> {
Found(&'a RuleConfigItemOptions),
NotFound,
Break,
}
fn find_rule<'a>(
rule: &'a RuleConfigItem,
active_conditions: &HashSet<String>,
) -> Option<&'a RuleConfigItemOptions> {
) -> FindRuleResult<'a> {
match rule {
RuleConfigItem::Options(rule) => {
return Some(rule);
}
RuleConfigItem::Options(rule) => FindRuleResult::Found(rule),
RuleConfigItem::Conditional(map) => {
for (condition, rule) in map.iter() {
if condition == "default" || active_conditions.contains(condition) {
if let Some(rule) = find_rule(rule, active_conditions) {
return Some(rule);
match find_rule(rule, active_conditions) {
FindRuleResult::Found(rule) => {
return FindRuleResult::Found(rule);
}
FindRuleResult::Break => {
return FindRuleResult::Break;
}
FindRuleResult::NotFound => {}
}
}
}
FindRuleResult::NotFound
}
RuleConfigItem::Boolean(_) => FindRuleResult::Break,
}
None
}
match rule {
RuleConfigItemOrShortcut::Loaders(loaders) => {
......@@ -767,7 +778,7 @@ impl NextConfig {
);
}
RuleConfigItemOrShortcut::Advanced(rule) => {
if let Some(RuleConfigItemOptions { loaders, rename_as }) =
if let FindRuleResult::Found(RuleConfigItemOptions { loaders, rename_as }) =
find_rule(rule, &active_conditions)
{
rules.insert(
......
......@@ -28,7 +28,7 @@ use crate::{
ModuleFeatureReportResolvePlugin, NextSharedRuntimeResolvePlugin,
UnsupportedModulesResolvePlugin,
},
util::foreign_code_context_condition,
util::{foreign_code_context_condition, NextRuntime},
};
fn defines(define_env: &IndexMap<String, String>) -> CompileTimeDefines {
......@@ -100,11 +100,13 @@ pub async fn get_edge_resolve_options_context(
let ty = ty.into_value();
// https://github.com/vercel/next.js/blob/bf52c254973d99fed9d71507a2e818af80b8ade7/packages/next/src/build/webpack-config.ts#L96-L102
let mut custom_conditions = vec![
mode.await?.condition().to_string(),
"edge-light".to_string(),
"worker".to_string(),
];
let mut custom_conditions = vec![mode.await?.condition().to_string()];
custom_conditions.extend(
NextRuntime::Edge
.conditions()
.iter()
.map(ToString::to_string),
);
match ty {
ServerContextType::AppRSC { .. } => custom_conditions.push("react-server".to_string()),
......
......@@ -9,7 +9,8 @@ use turbopack_binding::{
core::{
reference_type::{CommonJsReferenceSubType, ReferenceType},
resolve::{
options::{ConditionValue, ImportMap, ImportMapping, ResolveOptions, ResolvedMap},
node::node_cjs_resolve_options,
options::{ConditionValue, ImportMap, ImportMapping, ResolvedMap},
parse::Request,
pattern::Pattern,
resolve, AliasPattern, ExternalType, ResolveAliasMap, SubpathValue,
......@@ -17,7 +18,6 @@ use turbopack_binding::{
source::Source,
},
node::execution_context::ExecutionContext,
turbopack::{resolve_options, resolve_options_context::ResolveOptionsContext},
},
};
......@@ -915,22 +915,6 @@ async fn insert_next_shared_aliases(
Ok(())
}
#[turbo_tasks::function]
async fn package_lookup_resolve_options(
project_path: Vc<FileSystemPath>,
) -> Result<Vc<ResolveOptions>> {
Ok(resolve_options(
project_path,
ResolveOptionsContext {
enable_node_modules: Some(project_path.root().resolve().await?),
enable_node_native_modules: true,
custom_conditions: vec!["development".to_string()],
..Default::default()
}
.cell(),
))
}
#[turbo_tasks::function]
pub async fn get_next_package(context_directory: Vc<FileSystemPath>) -> Result<Vc<FileSystemPath>> {
let result = resolve(
......@@ -939,7 +923,7 @@ pub async fn get_next_package(context_directory: Vc<FileSystemPath>) -> Result<V
Request::parse(Value::new(Pattern::Constant(
"next/package.json".to_string(),
))),
package_lookup_resolve_options(context_directory),
node_cjs_resolve_options(context_directory.root()),
);
let source = result
.first_source()
......
use std::iter::once;
use anyhow::Result;
use indexmap::IndexMap;
use turbo_tasks::{Value, Vc};
......@@ -26,7 +28,7 @@ use turbopack_binding::{
condition::ContextCondition,
module_options::{
JsxTransformOptions, MdxTransformModuleOptions, ModuleOptionsContext, ModuleRule,
TypescriptTransformOptions, WebpackLoadersOptions,
TypescriptTransformOptions,
},
resolve_options_context::ResolveOptionsContext,
transition::Transition,
......@@ -39,10 +41,9 @@ use super::{
transforms::{get_next_server_internal_transforms_rules, get_next_server_transforms_rules},
};
use crate::{
babel::maybe_add_babel_loader,
embed_js::next_js_fs,
mode::NextMode,
next_build::{get_external_next_compiled_package_mapping, get_postcss_package_mapping},
next_build::get_postcss_package_mapping,
next_client::RuntimeEntries,
next_config::NextConfig,
next_import_map::{get_next_server_import_map, mdx_import_source_file},
......@@ -61,8 +62,8 @@ use crate::{
styled_jsx::get_styled_jsx_transform_rule,
swc_ecma_transform_plugins::get_swc_ecma_transform_plugin_rule,
},
webpack_rules::webpack_loader_options,
},
sass::maybe_add_sass_loader,
transform_options::{
get_decorators_transform_options, get_jsx_transform_options,
get_typescript_transform_options,
......@@ -97,21 +98,6 @@ pub enum ServerContextType {
Instrumentation,
}
impl ServerContextType {
pub fn conditions(&self) -> &'static [&'static str] {
match self {
ServerContextType::Pages { .. } => &["next-server", "next-pages", "next-ssr"],
ServerContextType::PagesApi { .. } => &["next-server", "next-pages", "next-api"],
ServerContextType::PagesData { .. } => &["next-server", "next-pages", "next-data"],
ServerContextType::AppSSR { .. } => &["next-server", "next-app", "next-ssr"],
ServerContextType::AppRSC { .. } => &["next-server", "next-app", "next-rsc"],
ServerContextType::AppRoute { .. } => &["next-server", "next-app", "next-route"],
ServerContextType::Middleware => &["next-server", "next-middleware"],
ServerContextType::Instrumentation => &["next-server", "next-instrumentation"],
}
}
}
#[turbo_tasks::function]
pub async fn get_server_resolve_options_context(
project_path: Vc<FileSystemPath>,
......@@ -157,8 +143,13 @@ pub async fn get_server_resolve_options_context(
);
let ty = ty.into_value();
let mut custom_conditions = vec![mode.await?.condition().to_string(), "node".to_string()];
custom_conditions.extend(ty.conditions().iter().map(ToString::to_string));
let mut custom_conditions = vec![mode.await?.condition().to_string()];
custom_conditions.extend(
NextRuntime::NodeJs
.conditions()
.iter()
.map(ToString::to_string),
);
match ty {
ServerContextType::AppRSC { .. }
......@@ -354,37 +345,28 @@ pub async fn get_server_module_options_context(
let enable_postcss_transform = Some(postcss_transform_options.cell());
let enable_foreign_postcss_transform = Some(postcss_foreign_transform_options.cell());
let mut conditions = vec![mode.await?.condition().to_string()];
conditions.extend(next_runtime.conditions().iter().map(ToString::to_string));
// A separate webpack rules will be applied to codes matching
// foreign_code_context_condition. This allows to import codes from
// node_modules that requires webpack loaders, which next-dev implicitly
// does by default.
let mut conditions = vec!["server".to_string(), mode.await?.condition().to_string()];
conditions.extend(ty.conditions().iter().map(ToString::to_string));
let foreign_webpack_rules = *next_config.webpack_rules(conditions).await?;
let foreign_webpack_rules =
maybe_add_sass_loader(next_config.sass_config(), foreign_webpack_rules).await?;
let foreign_webpack_loaders = foreign_webpack_rules.map(|rules| {
WebpackLoadersOptions {
rules,
loader_runner_package: Some(get_external_next_compiled_package_mapping(Vc::cell(
"loader-runner".to_owned(),
))),
}
.cell()
});
let foreign_enable_webpack_loaders = webpack_loader_options(
project_path,
next_config,
true,
conditions
.iter()
.cloned()
.chain(once("foreign".to_string()))
.collect(),
)
.await?;
// Now creates a webpack rules that applies to all codes.
let webpack_rules = *foreign_webpack_rules.clone();
let webpack_rules = *maybe_add_babel_loader(project_path, webpack_rules).await?;
let enable_webpack_loaders = webpack_rules.map(|rules| {
WebpackLoadersOptions {
rules,
loader_runner_package: Some(get_external_next_compiled_package_mapping(Vc::cell(
"loader-runner".to_owned(),
))),
}
.cell()
});
let enable_webpack_loaders =
webpack_loader_options(project_path, next_config, false, conditions).await?;
let use_swc_css = *next_config.use_swc_css().await?;
let versions = RuntimeVersions(Default::default()).cell();
......@@ -481,7 +463,7 @@ pub async fn get_server_module_options_context(
let foreign_code_module_options_context = ModuleOptionsContext {
custom_rules: foreign_next_server_rules.clone(),
enable_webpack_loaders: foreign_webpack_loaders,
enable_webpack_loaders: foreign_enable_webpack_loaders,
// NOTE(WEB-1016) PostCSS transforms should also apply to foreign code.
enable_postcss_transform: enable_foreign_postcss_transform,
..module_options_context.clone()
......@@ -535,7 +517,7 @@ pub async fn get_server_module_options_context(
let foreign_code_module_options_context = ModuleOptionsContext {
custom_rules: foreign_next_server_rules.clone(),
enable_webpack_loaders: foreign_webpack_loaders,
enable_webpack_loaders: foreign_enable_webpack_loaders,
// NOTE(WEB-1016) PostCSS transforms should also apply to foreign code.
enable_postcss_transform: enable_foreign_postcss_transform,
..module_options_context.clone()
......@@ -603,7 +585,7 @@ pub async fn get_server_module_options_context(
let foreign_code_module_options_context = ModuleOptionsContext {
custom_rules: foreign_next_server_rules.clone(),
enable_webpack_loaders: foreign_webpack_loaders,
enable_webpack_loaders: foreign_enable_webpack_loaders,
// NOTE(WEB-1016) PostCSS transforms should also apply to foreign code.
enable_postcss_transform: enable_foreign_postcss_transform,
..module_options_context.clone()
......@@ -643,7 +625,7 @@ pub async fn get_server_module_options_context(
};
let foreign_code_module_options_context = ModuleOptionsContext {
custom_rules: internal_custom_rules.clone(),
enable_webpack_loaders: foreign_webpack_loaders,
enable_webpack_loaders: foreign_enable_webpack_loaders,
// NOTE(WEB-1016) PostCSS transforms should also apply to foreign code.
enable_postcss_transform: enable_foreign_postcss_transform,
..module_options_context.clone()
......@@ -690,7 +672,7 @@ pub async fn get_server_module_options_context(
};
let foreign_code_module_options_context = ModuleOptionsContext {
custom_rules: internal_custom_rules.clone(),
enable_webpack_loaders: foreign_webpack_loaders,
enable_webpack_loaders: foreign_enable_webpack_loaders,
// NOTE(WEB-1016) PostCSS transforms should also apply to foreign code.
enable_postcss_transform: enable_foreign_postcss_transform,
..module_options_context.clone()
......
pub(crate) mod resolve;
pub(crate) mod transforms;
pub(crate) mod webpack_rules;
......@@ -6,14 +6,10 @@ use turbopack_binding::{
core::{
issue::{Issue, IssueExt, IssueSeverity, IssueStage, OptionStyledString, StyledString},
reference_type::{CommonJsReferenceSubType, ReferenceType},
resolve::{parse::Request, pattern::Pattern, resolve},
resolve::{node::node_cjs_resolve_options, parse::Request, pattern::Pattern, resolve},
},
node::transforms::webpack::WebpackLoaderItem,
turbopack::{
module_options::{LoaderRuleItem, OptionWebpackRules, WebpackRules},
resolve_options,
resolve_options_context::ResolveOptionsContext,
},
turbopack::module_options::{LoaderRuleItem, OptionWebpackRules, WebpackRules},
},
};
......@@ -128,16 +124,7 @@ pub async fn is_babel_loader_available(project_path: Vc<FileSystemPath>) -> Resu
Request::parse(Value::new(Pattern::Constant(
"babel-loader/package.json".to_string(),
))),
resolve_options(
project_path,
ResolveOptionsContext {
enable_node_modules: Some(project_path.root().resolve().await?),
enable_node_native_modules: true,
custom_conditions: vec!["development".to_string()],
..Default::default()
}
.cell(),
),
node_cjs_resolve_options(project_path),
);
let assets = result.primary_sources().await?;
Ok(Vc::cell(!assets.is_empty()))
......
use anyhow::Result;
use turbo_tasks::Vc;
use turbo_tasks_fs::FileSystemPath;
use turbopack_binding::turbopack::{
core::resolve::options::ImportMapping, turbopack::module_options::WebpackLoadersOptions,
};
use self::{babel::maybe_add_babel_loader, sass::maybe_add_sass_loader};
use crate::{next_build::get_external_next_compiled_package_mapping, next_config::NextConfig};
pub(crate) mod babel;
pub(crate) mod sass;
pub async fn webpack_loader_options(
project_path: Vc<FileSystemPath>,
next_config: Vc<NextConfig>,
foreign: bool,
conditions: Vec<String>,
) -> Result<Option<Vc<WebpackLoadersOptions>>> {
let rules = *next_config.webpack_rules(conditions).await?;
let rules = *maybe_add_sass_loader(next_config.sass_config(), rules).await?;
let rules = if foreign {
rules
} else {
*maybe_add_babel_loader(project_path, rules).await?
};
Ok(rules.map(|rules| {
WebpackLoadersOptions {
rules,
loader_runner_package: Some(loader_runner_package_mapping()),
}
.cell()
}))
}
#[turbo_tasks::function]
fn loader_runner_package_mapping() -> Vc<ImportMapping> {
get_external_next_compiled_package_mapping(Vc::cell("loader-runner".to_owned()))
}
......@@ -142,6 +142,15 @@ pub enum NextRuntime {
Edge,
}
impl NextRuntime {
pub fn conditions(&self) -> &'static [&'static str] {
match self {
NextRuntime::NodeJs => &["node"],
NextRuntime::Edge => &["edge-light", "worker"],
}
}
}
#[turbo_tasks::value]
#[derive(Default, Clone)]
pub struct NextSourceConfig {
......
......@@ -1164,6 +1164,7 @@ function bindingToApi(binding: any, _wasm: boolean) {
}
function checkConfigItem(rule: TurboRuleConfigItem, glob: string) {
if (!rule) return
if ('loaders' in rule) {
checkLoaderItems((rule as TurboRuleConfigItemOptions).loaders, glob)
} else {
......
......@@ -8,6 +8,8 @@ import type { SizeLimit } from '../../types'
import type {
ExportPathMap,
TurboLoaderItem,
TurboRuleConfigItem,
TurboRuleConfigItemOptions,
TurboRuleConfigItemOrShortcut,
} from './config-shared'
import type {
......@@ -103,14 +105,24 @@ const zTurboLoaderItem: zod.ZodType<TurboLoaderItem> = z.union([
}),
])
const zTurboRule: zod.ZodType<TurboRuleConfigItemOrShortcut> = z.union([
z.array(zTurboLoaderItem),
const zTurboRuleConfigItemOptions: zod.ZodType<TurboRuleConfigItemOptions> =
z.object({
loaders: z.array(zTurboLoaderItem),
as: z.string(),
}),
as: z.string().optional(),
})
const zTurboRuleConfigItem: zod.ZodType<TurboRuleConfigItem> = z.union([
z.literal(false),
z.record(
z.string(),
z.lazy(() => zTurboRuleConfigItem)
),
zTurboRuleConfigItemOptions,
])
const zTurboRuleConfigItemOrShortcut: zod.ZodType<TurboRuleConfigItemOrShortcut> =
z.union([z.array(zTurboLoaderItem), zTurboRuleConfigItem])
export const configSchema: zod.ZodType<NextConfig> = z.lazy(() =>
z.strictObject({
amp: z
......@@ -339,7 +351,9 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() =>
turbo: z
.object({
loaders: z.record(z.string(), z.array(zTurboLoaderItem)).optional(),
rules: z.record(z.string(), zTurboRule).optional(),
rules: z
.record(z.string(), zTurboRuleConfigItemOrShortcut)
.optional(),
resolveAlias: z
.record(
z.string(),
......
......@@ -102,12 +102,13 @@ export type TurboRuleConfigItemOrShortcut =
export type TurboRuleConfigItemOptions = {
loaders: TurboLoaderItem[]
as: string
as?: string
}
export type TurboRuleConfigItem =
| TurboRuleConfigItemOptions
| { [condition: string]: TurboRuleConfigItem }
| false
export interface ExperimentalTurboOptions {
/**
......
'use client'
import test from './file.test-file.js'
import foreignTest from 'package/file.test-file.js'
export default function Client() {
return <p>client: {JSON.stringify(test)}</p>
return (
<>
<p>client: {JSON.stringify(test)}</p>
<p>foreignClient: {JSON.stringify(foreignTest)}</p>
</>
)
}
......@@ -7,23 +7,24 @@ const nextConfig = {
rules: {
'*.test-file.js': {
browser: {
loaders: [
{
loader: require.resolve('./test-file-loader.js'),
options: { browser: true },
},
],
},
'next-app': {
'next-ssr': {
foreign: {
loaders: [
{
loader: require.resolve('./test-file-loader.js'),
options: { browser: true, foreign: true },
},
],
},
default: {
loaders: [
{
loader: require.resolve('./test-file-loader.js'),
options: { nextSsr: true },
options: { browser: true },
},
],
},
},
foreign: false,
default: {
loaders: [
{
......
......@@ -14,7 +14,8 @@ describe('webpack-loader-conditions', () => {
const res = await next.fetch('/')
const html = (await res.text()).replaceAll(/<!-- -->/g, '')
expect(html).toContain(`server: {&quot;default&quot;:true}`)
expect(html).toContain(`client: {&quot;nextSsr&quot;:true}`)
expect(html).toContain(`client: {&quot;default&quot;:true}`)
expect(html).toContain(`foreignClient: {}`)
})
it('should render correctly on client side', async () => {
......@@ -22,5 +23,8 @@ describe('webpack-loader-conditions', () => {
const text = await browser.elementByCss('body').text()
expect(text).toContain(`server: ${JSON.stringify({ default: true })}`)
expect(text).toContain(`client: ${JSON.stringify({ browser: true })}`)
expect(text).toContain(
`foreignClient: ${JSON.stringify({ browser: true, foreign: true })}`
)
})
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment