Home > OS >  Why is jasmine unable to find my unit tests?
Why is jasmine unable to find my unit tests?

Time:07-14

my folder structure looks like this folder structure

my jasmine.json file

{
    "spec_dir": "dist/tests",
    "spec_files": ["**/*[sS]pec.js"],
    "helpers": ["helpers/**/*.js"],
    "stopSpecOnExpectationFailure": false,
    "random": false
} 

if i make a simple unit test on index.ts

const myFunc = (num: number): number => {
  return num * num;
};

export default myFunc;

and on indexSpec.ts

import myFunc from '../index';

it('expect myFunc(5) to equal 25', () => {
  expect(myFunc(5)).toEqual(25);
});

i get this output

No specs found Finished in 0.007 seconds Incomplete: No specs found

CodePudding user response:

That's because you specify that you want to test files with the .js extension but you are coding in a .ts

  • Related