PuzzleScript icon indicating copy to clipboard operation
PuzzleScript copied to clipboard

Global init level is wrong type

Open david-pfx opened this issue 1 year ago • 2 comments

initLevel is of type Object, but level is of type Level. This is the core bug.

If a compile fails before it creates any levels, then the level is never set correctly, and convertLevelToString fails with a TypeError. So there is no output from the test.

As well, wrapper.js suppresses all console output, making this a totally silent and mysterious failure.

As a workaround, patching consolePrint() in wrapper.js is enough to allow these errors to be diagnosed. Why is it switched off?

I'm happy to provide fixes, but need feedback first.

david-pfx avatar Mar 05 '23 01:03 david-pfx

Hello, this issue has me a bit confused.

Could you tell me the name of one of the tests that exhibits this behaviour?

When you say there's no output from the test - if there's no output from a test I'd assume the test would loudly fail...are you saying that some tests aren't actually being run because they're terminating mid-way?

increpare avatar Mar 10 '23 16:03 increpare

Just run the tests in the debugger and watch the console. See below. There are two exceptions that are trapped but do not emit error messages (except to the console). The rest are type errors that should not happen. I know why, but the fix is not one I'd like to make without consultation.

compiler.js:2914 aborting compilation
testingFrameWork.js:83 TypeError: Cannot read properties of undefined (reading 'STRIDE_MOV')
    at setGameState (engine.js:604:23)
    at compile (compiler.js:2959:9)
    at runCompilationTest (testingFrameWork.js:81:3)
    at Object.<anonymous> (tests.js:57:8)
    at Test.run (qunit-1.12.0.js:203:18)
    at qunit-1.12.0.js:361:10
    at process (qunit-1.12.0.js:1453:24)
    at next (qunit-1.12.0.js:1446:3)
compiler.js:2914 Error: Too many errors/warnings; aborting compilation.
    at TooManyErrors (parser.js:32:11)
    at logError (parser.js:67:17)
    at checkObjectsAreLayered (compiler.js:2203:17)
    at loadFile (compiler.js:2847:5)
    at compile (compiler.js:2911:21)
    at runCompilationTest (testingFrameWork.js:81:3)
    at Object.<anonymous> (tests.js:57:8)
    at Test.run (qunit-1.12.0.js:203:18)
    at qunit-1.12.0.js:361:10
    at process (qunit-1.12.0.js:1453:24)
compiler.js:2914 TypeError: Cannot read properties of undefined (reading 'layer')
    at generateExtraMembers (compiler.js:358:51)
    at loadFile (compiler.js:2817:5)
    at compile (compiler.js:2911:21)
    at runCompilationTest (testingFrameWork.js:81:3)
    at Object.<anonymous> (tests.js:57:8)
    at Test.run (qunit-1.12.0.js:203:18)
    at qunit-1.12.0.js:361:10
    at process (qunit-1.12.0.js:1453:24)
    at next (qunit-1.12.0.js:1446:3)
testingFrameWork.js:83 TypeError: Cannot read properties of undefined (reading 'STRIDE_MOV')
    at setGameState (engine.js:604:23)
    at compile (compiler.js:2959:9)
    at runCompilationTest (testingFrameWork.js:81:3)
    at Object.<anonymous> (tests.js:57:8)
    at Test.run (qunit-1.12.0.js:203:18)
    at qunit-1.12.0.js:361:10
    at process (qunit-1.12.0.js:1453:24)
    at next (qunit-1.12.0.js:1446:3)
compiler.js:2914 TypeError: Cannot read properties of undefined (reading 'push')
    at generateSoundData (compiler.js:2699:56)
    at loadFile (compiler.js:2853:5)
    at compile (compiler.js:2911:21)
    at runCompilationTest (testingFrameWork.js:81:3)
    at Object.<anonymous> (tests.js:57:8)
    at Test.run (qunit-1.12.0.js:203:18)
    at qunit-1.12.0.js:361:10
    at process (qunit-1.12.0.js:1453:24)
    at next (qunit-1.12.0.js:1446:3)
compiler.js:2914 TypeError: Cannot read properties of undefined (reading 'anyBitsInCommon')
    at levelFromString (compiler.js:476:34)
    at levelsToArray (compiler.js:505:21)
    at loadFile (compiler.js:2819:5)
    at compile (compiler.js:2911:21)
    at runCompilationTest (testingFrameWork.js:81:3)
    at Object.<anonymous> (tests.js:57:8)
    at Test.run (qunit-1.12.0.js:203:18)
    at qunit-1.12.0.js:361:10
    at process (qunit-1.12.0.js:1453:24)
    at next (qunit-1.12.0.js:1446:3)
testingFrameWork.js:83 TypeError: Cannot read properties of undefined (reading 'STRIDE_MOV')
    at setGameState (engine.js:604:23)
    at compile (compiler.js:2959:9)
    at runCompilationTest (testingFrameWork.js:81:3)
    at Object.<anonymous> (tests.js:57:8)
    at Test.run (qunit-1.12.0.js:203:18)
    at qunit-1.12.0.js:361:10
    at process (qunit-1.12.0.js:1453:24)
    at next (qunit-1.12.0.js:1446:3)
compiler.js:2914 TypeError: Cannot read properties of undefined (reading 'groupNumber')
    at processRuleString (compiler.js:678:73)
    at rulesToArray (compiler.js:897:23)
    at loadFile (compiler.js:2820:5)
    at compile (compiler.js:2911:21)
    at runCompilationTest (testingFrameWork.js:81:3)
    at Object.<anonymous> (tests.js:57:8)
    at Test.run (qunit-1.12.0.js:203:18)
    at qunit-1.12.0.js:361:10
    at process (qunit-1.12.0.js:1453:24)
    at next (qunit-1.12.0.js:1446:3)
testingFrameWork.js:83 TypeError: Cannot read properties of undefined (reading 'STRIDE_MOV')
    at setGameState (engine.js:604:23)
    at compile (compiler.js:2959:9)
    at runCompilationTest (testingFrameWork.js:81:3)
    at Object.<anonymous> (tests.js:57:8)
    at Test.run (qunit-1.12.0.js:203:18)
    at qunit-1.12.0.js:361:10
    at process (qunit-1.12.0.js:1453:24)
    at next (qunit-1.12.0.js:1446:3)
compiler.js:2914 TypeError: Cannot read properties of undefined (reading 'reverse')
    at rewriteUpLeftRules (compiler.js:991:25)
    at rulesToArray (compiler.js:933:9)
    at loadFile (compiler.js:2820:5)
    at compile (compiler.js:2911:21)
    at runCompilationTest (testingFrameWork.js:81:3)
    at Object.<anonymous> (tests.js:57:8)
    at Test.run (qunit-1.12.0.js:203:18)
    at qunit-1.12.0.js:361:10
    at process (qunit-1.12.0.js:1453:24)
    at next (qunit-1.12.0.js:1446:3)
testingFrameWork.js:83 TypeError: Cannot read properties of undefined (reading 'STRIDE_MOV')
    at setGameState (engine.js:604:23)
    at compile (compiler.js:2959:9)
    at runCompilationTest (testingFrameWork.js:81:3)
    at Object.<anonymous> (tests.js:57:8)
    at Test.run (qunit-1.12.0.js:203:18)
    at qunit-1.12.0.js:361:10
    at process (qunit-1.12.0.js:1453:24)
    at next (qunit-1.12.0.js:1446:3)
compiler.js:2914 aborting compilation
testingFrameWork.js:83 TypeError: Cannot read properties of undefined (reading 'STRIDE_MOV')
    at setGameState (engine.js:604:23)
    at compile (compiler.js:2959:9)
    at runCompilationTest (testingFrameWork.js:81:3)
    at Object.<anonymous> (tests.js:57:8)
    at Test.run (qunit-1.12.0.js:203:18)
    at qunit-1.12.0.js:361:10
    at process (qunit-1.12.0.js:1453:24)
    at next (qunit-1.12.0.js:1446:3)

david-pfx avatar Mar 10 '23 23:03 david-pfx