-
Please let me know if this is the right place for this question. I'm a regular user, doing exclusively JavaScript challenges. I do all of my coding of the challenges in vscode on my device. I'd like to be able to run the tests in vscode as well. I am a little familiar with using Jest in React projects. I can't figure out what testing package I should be installing, though. This is the challenge I'm working on now: https://www.codewars.com/kata/52742f58faf5485cae000b9a/train/javascript This is what the testing block looks like: describe("Tests", () => {
it("test", () => {
Test.assertEquals(formatDuration(1), "1 second");
}); }); I have also seen this kind of test const chai = require("chai");
const assert = chai.assert;
chai.config.truncateThreshold=0;
describe("Basic tests", () => {
it("Testing for fixed tests", () => {
assert.strictEqual(solution('world'), 'dlrow');
}); }); I have read through this document and I'm not quite seeing what testing package I should install. This challenge is Node v8.1.3. However the above document only talks about 10x and 12x. Should I just install Mocha and Chai? Does anyone have advice on the best VS Code plugins to use? I'm very new at this so please assume I don't know what I'm doing 😬! Thanks!
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
If you see Install that with const Test = require("@codewars/test-compat");
describe("Tests", () => {
it("test", () => {
Test.assertEquals(formatDuration(1), "1 second");
});
}); You should be able to run the test with Mocha. Also, Codewars currently concatenates solution and tests, so write your solution in the same file. |
Beta Was this translation helpful? Give feedback.
If you see
Test.
from old kata, you need@codewars/test-compat
.Install that with
npm i -D @codewars/test-compat
then:You should be able to run the test with Mocha.
Also, Codewars currently concatenates solution and tests, so write your solution in the same file.