Closed fatadel closed 3 years ago
I see. Do you have a solution for this that can be posted on the forum? Maybe slicing out command-line arguments before passing them to the main
function?
@alessiogambi
I think you can change main(process.argv)
to main(process.argv.pop())
in the main script.
The only inconsistency that remains then will be in case of no config.
The tests will pass nothing while direct invocation will pass the path to the entry point script as the argument.
But this is just a small inconsistency and both cases can be easily checked against in the program.
I close this issue, since it does not apply to the program description, but I link this to the forum on StudIP for future reference.
In the
minesweeper.js
file, the arguments are passed to themain
method asmain(process.argv)
, which is an array of strings (first item is a path to node executable, second item path to the entry point script, third item is the first argument and so on). However, when running the tests they pass an argument as just a string (or nothing at all), likeminesweeper.main("simple.cfg")
(orminesweeper.main()
). This leads to inconsistency between the program logic and the test logic.