First test "all tests should pass" fails when using the glitch boilerplate.
This is because it tests for a NODE_ENGINE env value which does not exist in the glitch boilerplate, so it's returning undefined. A user can fix this manually by adding it to the env file of the glitch project.
This could be fixed by providing instructions in the challenge on how to add the environment variable to the env file, or by changes to the boilerplate to set the env file variable.
cc @tchaffee and @Em-Ant
the new url https://learn.freecodecamp.org/information-security-and-quality-assurance/quality-assurance-and-testing-with-chai doesn't work. I get NOT FOUND
@Em-Ant some of the challenge superblocks (section intros) are not yet added. You should be able to visit indiviual challenges with the search though.
@clandau both the boilerplate https://glitch.com/edit/#!/sincere-cone?path=server.js:70:2 and the repo https://github.com/freeCodeCamp/boilerplate-mochachai/blob/gomix/server.js use only the SKIP_TESTS env var, which should be explicitly set to prevent the tests from running. All the tests run by default. Where do you see the reference to NODE_ENGINE ?
@Em-Ant it's at line 141 in tests/1_unit-tests.js of the glitch boilerplate
Ok, got it. The boilerplate cannot set the env file itself. Do you think we should replace that test with another one ? What could be a good example ? Any suggestions ?
@Em-Ant can you send me the boilerplate, I can take a look at it, and share my suggestions?
@Em-Ant I'll look into the tests when I get a chance. @accimeesterlin is this what you're looking for? https://github.com/freeCodeCamp/boilerplate-mochachai
@clandau by the way, I don't remember exactly but I think that at the beginning NODE_ENGINE was one of the env vars defined by default in a hyperdev/gomix/glitch project. Now it's not used anymore. Try to console.log(process.env) in a glitch empty project, you will see many env vars defined. We could simply use a different one, but probably it's not something we can rely on for the future.
@Em-Ant How about PATH or NAME? Assuming these exist on every system.
Something like:
assert.fail(process.env.PATH, 'env vars are strings (or undefined)');
Or just make it really simple and change it to a string:
assert.fail('lorem ipsum', '"lorem ipsum" is a string');
#entire test
test('#isString, #isNotString', function() {
assert.fail(Math.sin(Math.PI/4), 'a float is not a string');
assert.fail(process.env.PATH, 'env vars are strings (or undefined)');
assert.fail(JSON.stringify({type: 'object'}), 'a JSON is a string');
});
Hi @Em-Ant and @clandau were you able to figure out a good solution for this?
@QuincyLarson @Em-Ant I did submit a pull request here: https://github.com/freeCodeCamp/boilerplate-mochachai/pull/2
It did the change that I mentioned above where I made the env var PATH instead of NODE_ENGINE with the thought that PATH is a variable that will be in projects by default.
It's up to you and your maintainers if you think the fix is appropriate.
@clandau @QuincyLarson I'll update the boilerplate with Courtney's change if it's ok.
(Done!)
Hi @Em-Ant can you confirm you were able to update this? If so, could you close this issue?
@QuincyLarson Yes I did it
@Em-Ant Awesome! Thank you for confirming you were able to update this!
Most helpful comment
@QuincyLarson @Em-Ant I did submit a pull request here: https://github.com/freeCodeCamp/boilerplate-mochachai/pull/2
It did the change that I mentioned above where I made the env var PATH instead of NODE_ENGINE with the thought that PATH is a variable that will be in projects by default.
It's up to you and your maintainers if you think the fix is appropriate.