brouberol/5esheets

Effect unit tests tests are failing

Closed this issue · 7 comments

$ NODE_ENV=prod npm run test                                                                                                                                          12:04:43 PM

> test
> vitest --run


 RUN  v0.32.4 /Users/br/code/5esheets/dnd5esheets/front

 ✓ src/effects/parser/index.test.ts (10)
 ❯ src/effects/index.test.ts (18)
   ❯ apply effect (18)
     ✓ applies a static effect
     ✓ applies a derived effect
     × applies a derived effect which updates from its dependency
     ✓ applies a nested derived effect
     × applies a nested derived effect which updates from its dependency
     ✓ applies a deeply nested derived effect
     × applies a nested derived effect which updates from its dependency
     ✓ applies a non-computed nested derived effect
     × applies a non-computed nested derived effect which updates from its dependency
     ✓ applies a non-computed deeply nested derived effect
     × applies a non-computed deeply nested derived effect which updates from its dependency
     ✓ applies an effect containing a function
     ✓ applies a derived effect containing a function
     × applies a derived effect containing a function which updates from its dependency
     × applies a somewhat complex effect which updates from its dependency
     × applies a somewhat complex effect on a nested target which updates from its dependency
     × applies a nested derived effect on a sibling target which updates from its dependency
     ↓ applies a derived effect containing a function which updates from its dependency [skipped]

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 9 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a derived effect which updates from its dependency
AssertionError: expected 1 to be 2 // Object.is equality

- Expected
+ Received

- 2
+ 1

 ❯ src/effects/index.test.ts:40:25
     38|       setContext("a", 2);
     39|       expect(context.a).toBe(2);
     40|       expect(context.b).toBe(context.a);
       |                         ^
     41|     }));
     42|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:35:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/9]⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a nested derived effect which updates from its dependency
AssertionError: expected 1 to be 2 // Object.is equality

- Expected
+ Received

- 2
+ 1

 ❯ src/effects/index.test.ts:55:25
     53|       applyEffect("b := nested.a", context, setContext);
     54|       setContext("nested", "a", 2);
     55|       expect(context.b).toBe(context.nested.a);
       |                         ^
     56|     }));
     57|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:51:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/9]⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a nested derived effect which updates from its dependency
AssertionError: expected 1 to be 2 // Object.is equality

- Expected
+ Received

- 2
+ 1

 ❯ src/effects/index.test.ts:74:25
     72|       applyEffect("b := deeply.nested.a", context, setContext);
     73|       setContext("deeply", "nested", "a", 2);
     74|       expect(context.b).toBe(context.deeply.nested.a);
       |                         ^
     75|     }));
     76|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:68:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/9]⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a non-computed nested derived effect which updates from its dependency
AssertionError: expected 1 to be 2 // Object.is equality

- Expected
+ Received

- 2
+ 1

 ❯ src/effects/index.test.ts:89:25
     87|       applyEffect("b := nested[key]", context, setContext);
     88|       setContext("nested", "a", 2);
     89|       expect(context.b).toBe(context.nested.a);
       |                         ^
     90|     }));
     91|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:85:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[4/9]⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a non-computed deeply nested derived effect which updates from its dependency
AssertionError: expected 1 to be 2 // Object.is equality

- Expected
+ Received

- 2
+ 1

 ❯ src/effects/index.test.ts:112:25
    110|       applyEffect("b := nested[key_][key__]", context, setContext);
    111|       setContext("nested", "a_", "a__", 2);
    112|       expect(context.b).toBe(context.nested.a_.a__);
       |                         ^
    113|     }));
    114|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:104:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[5/9]⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a derived effect containing a function which updates from its dependency
AssertionError: expected 1 to be 2 // Object.is equality

- Expected
+ Received

- 2
+ 1

 ❯ src/effects/index.test.ts:134:25
    132|       applyEffect("b := id(a)", context, setContext);
    133|       setContext("a", 2);
    134|       expect(context.b).toBe(context.a);
       |                         ^
    135|     }));
    136|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:130:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[6/9]⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a somewhat complex effect which updates from its dependency
AssertionError: expected 3 to be 4 // Object.is equality

- Expected
+ Received

- 4
+ 3

 ❯ src/effects/index.test.ts:150:25
    148|       );
    149|       setContext("nested", "a", 2);
    150|       expect(context.d).toBe(4);
       |                         ^
    151|     }));
    152|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:138:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[7/9]⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a somewhat complex effect on a nested target which updates from its dependency
AssertionError: expected 3 to be 4 // Object.is equality

- Expected
+ Received

- 4
+ 3

 ❯ src/effects/index.test.ts:167:32
    165|       );
    166|       setContext("nested", "a", 2);
    167|       expect(context.effect.d).toBe(4);
       |                                ^
    168|     }));
    169|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:154:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[8/9]⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a nested derived effect on a sibling target which updates from its dependency
AssertionError: expected 1 to be 2 // Object.is equality

- Expected
+ Received

- 2
+ 1

 ❯ src/effects/index.test.ts:179:32
    177|       applyEffect("nested.d := nested.a", context, setContext);
    178|       setContext("nested", "a", 2);
    179|       expect(context.nested.d).toBe(context.nested.a);
       |                                ^
    180|     }));
    181|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:171:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[9/9]⎯

 Test Files  1 failed | 1 passed (2)
      Tests  9 failed | 18 passed | 1 skipped (28)
   Start at  12:06:33
   Duration  506ms (transform 91ms, setup 0ms, collect 193ms, tests 20ms, environment 414ms, prepare 111ms)

Every single failing test has from its dependency in the test description. I'm thinking there's something wrong when it comes to propagating dependent changes.

Tests are ... passing with node 18.16.0 and failing with node 20.3.1.

I've defined a Dockerfile for the frontend, as such

FROM node:18.16.1
WORKDIR /usr/src/app
COPY package-lock.json .
COPY package.json .
RUN npm install

and built it with cd dnd5esheets/front && docker build -t 5esheets-front .. In then renamed my local node_modules to node_modules-old to avoid shadowing the node_modules in the container, and ran cd dnd5esheets/front && docker run -it -v "$(pwd)/:/usr/src/app/" 5esheets-front bash

root@3195b611cbe7:/usr/src/app# npm exec vitest --config vitest.config.js  src/effects/index.test.ts  src/effects/parser/index.test.ts

 DEV  v0.32.2 /usr/src/app

 ✓ src/effects/parser/index.test.ts (10)
 ✓ src/effects/index.test.ts (18)

 Test Files  2 passed (2)
      Tests  27 passed | 1 skipped (28)
   Start at  12:27:26
   Duration  4.35s (transform 164ms, setup 1.28s, collect 368ms, tests 17ms, environment 2.50s, prepare 415ms)

That works

I then built another docker image defined as

FROM node:20.2.0-bullseye-slim
WORKDIR /usr/src/app
COPY package-lock.json .
COPY package.json .
RUN npm install

and ran the same steps. This time, the tests failed:

root@92519af685a1:/usr/src/app# npm exec vitest --config vitest.config.js  src/effects/index.test.ts  src/effects/parser/index.test.ts

 DEV  v0.32.2 /usr/src/app

 ✓ src/effects/parser/index.test.ts (10)
 ❯ src/effects/index.test.ts (18)
   ❯ apply effect (18)
     × applies a static effect
     × applies a derived effect
     × applies a derived effect which updates from its dependency
     × applies a nested derived effect
     × applies a nested derived effect which updates from its dependency
     × applies a deeply nested derived effect
     × applies a nested derived effect which updates from its dependency
     × applies a non-computed nested derived effect
     × applies a non-computed nested derived effect which updates from its dependency
     × applies a non-computed deeply nested derived effect
     × applies a non-computed deeply nested derived effect which updates from its dependency
     × applies an effect containing a function
     × applies a derived effect containing a function
     × applies a derived effect containing a function which updates from its dependency
     × applies a somewhat complex effect which updates from its dependency
     × applies a somewhat complex effect on a nested target which updates from its dependency
     × applies a nested derived effect on a sibling target which updates from its dependency
     ↓ applies a derived effect containing a function which updates from its dependency [skipped]

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 17 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a static effect
TypeError: Cannot read properties of undefined (reading 'registerGraph')
 ❯ Module.createStore node_modules/solid-js/store/dist/dev.js:213:9

 ❯ src/effects/index.test.ts:21:37
 ❯ src/effects/index.test.ts:11:7
 ❯ updateFn node_modules/solid-js/dist/dev.js:180:17
 ❯ runUpdates node_modules/solid-js/dist/dev.js:800:17
 ❯ Module.createRoot node_modules/solid-js/dist/dev.js:185:12
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:20:5
 ...

At that point, we see the issue that I tried to fix in #96. I thus prefix the command by exporting NODE_ENV=whatever

root@b62e906cd236:/usr/src/app# NODE_ENV=development npm exec vitest --config vitest.config.js  src/effects/index.test.ts  src/effects/parser/index.test.ts

 DEV  v0.32.2 /usr/src/app

 ✓ src/effects/parser/index.test.ts (10)
 ❯ src/effects/index.test.ts (18)
   ❯ apply effect (18)
     ✓ applies a static effect
     ✓ applies a derived effect
     × applies a derived effect which updates from its dependency
     ✓ applies a nested derived effect
     × applies a nested derived effect which updates from its dependency
     ✓ applies a deeply nested derived effect
     × applies a nested derived effect which updates from its dependency
     ✓ applies a non-computed nested derived effect
     × applies a non-computed nested derived effect which updates from its dependency
     ✓ applies a non-computed deeply nested derived effect
     × applies a non-computed deeply nested derived effect which updates from its dependency
     ✓ applies an effect containing a function
     ✓ applies a derived effect containing a function
     × applies a derived effect containing a function which updates from its dependency
     × applies a somewhat complex effect which updates from its dependency
     × applies a somewhat complex effect on a nested target which updates from its dependency
     × applies a nested derived effect on a sibling target which updates from its dependency
     ↓ applies a derived effect containing a function which updates from its dependency [skipped]

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 9 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  src/effects/index.test.ts > apply effect > applies a derived effect which updates from its dependency
AssertionError: expected 1 to be 2 // Object.is equality

- Expected
+ Received

- 1
+ 2

 ❯ src/effects/index.test.ts:38:25
     36|       applyEffect("b := a", context, setContext);
     37|       setContext("a", 2);
     38|       expect(context.b).toBe(context.a);
       |                         ^
     39|     }));
     40|
 ❯ src/effects/index.test.ts:11:7
 ❯ Module.createRoot node_modules/solid-js/dist/server.js:53:14
 ❯ src/effects/index.test.ts:10:5
 ❯ inRoot src/effects/index.test.ts:9:9
 ❯ src/effects/index.test.ts:34:5
 ...

@etnbrd do you want to try to debug this, or should we pin node to 18.16.1 and call it a day?

Frontend tests are succeeding when using node 18.16.1 in CI: https://github.com/brouberol/5esheets/actions/runs/5464409518/jobs/9946400764?pr=97

etnbrd commented

If it works with 18.16.1, let's use this version, and we'll retry later to have a better understanding of what's wrong.

Cool. I've added an .nvmrc file containing the node version we pinned the project to, installable via nvm.

~/code/5esheets main *2 ❯ node --version 
v18.16.1
~/code/5esheets main *2 ?3 ❯ make front-test 

 [+] Running the frontend tests

> test
> vitest


 DEV  v0.32.2 /Users/br/code/5esheets/dnd5esheets/front

 ✓ src/effects/parser/index.test.ts (10)
 ✓ src/effects/index.test.ts (18)

 Test Files  2 passed (2)
      Tests  27 passed | 1 skipped (28)

We're all good!