File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
packages/@lwc/integration-not-karma
test/shadow-dom/Node-properties Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -3,11 +3,24 @@ import { LWC_VERSION } from '@lwc/shared';
33import * as options from '../helpers/options.js' ;
44import { resolvePathOutsideRoot } from '../helpers/utils.js' ;
55
6+ /**
7+ * We want to convert from parsed options (true/false) to a `process.env` with only strings.
8+ * This drops `false` values and converts everything else to a string.
9+ */
10+ const envify = ( obj ) => {
11+ const clone = { } ;
12+ for ( const [ key , val ] of Object . entries ( obj ) ) {
13+ if ( val !== false ) {
14+ clone [ key ] = String ( val ) ;
15+ }
16+ }
17+ return clone ;
18+ } ;
619const pluck = ( obj , keys ) => Object . fromEntries ( keys . map ( ( k ) => [ k , obj [ k ] ] ) ) ;
720const maybeImport = ( file , condition ) => ( condition ? `await import('${ file } ');` : '' ) ;
821
922/** `process.env` to inject into test environment. */
10- const env = {
23+ const env = envify ( {
1124 ...pluck ( options , [
1225 'API_VERSION' ,
1326 'DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE' ,
@@ -21,7 +34,7 @@ const env = {
2134 ] ) ,
2235 LWC_VERSION ,
2336 NODE_ENV : options . NODE_ENV_FOR_TEST ,
24- } ;
37+ } ) ;
2538
2639/** @type {import("@web/test-runner").TestRunnerConfig } */
2740export default {
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ describe('Node.hasChildNodes', () => {
2626
2727 expect ( container . shadowRoot . querySelector ( '.container' ) . hasChildNodes ( ) ) . toBe ( true ) ;
2828 expect ( container . shadowRoot . querySelector ( 'slot' ) . hasChildNodes ( ) ) . toBe (
29- process . env . NATIVE_SHADOW
29+ Boolean ( process . env . NATIVE_SHADOW )
3030 ) ;
3131 } ) ;
3232} ) ;
You can’t perform that action at this time.
0 commit comments