Chutzpah can't find Typescript Jasmine tests in VS 2022 Test Explorer

63 Views Asked by At

I have used Chutzpah as a Javascript test runner in Visual Studio 2022 for a while now, and it's worked beautifully. I was using straight javascript before, but am now trying to migrate my project to Typescript. In doing so, I can't get any of my tests to show in the Visual Studio Test Explorer, when the plain javascript tests did show before. I am using version 4.4.12 of the Chutzpah Test Explorer Adapter 2022.

tsconfig.json:

{
  "compileOnSave": true,
  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "ES5",
    "outDir": "_out",
    "module": "CommonJS"
  },
  "include": [
    "ClientApp/src/**/*"
  ],
  "exclude": [
    "node_modules",
    "wwwroot"
  ]
}

chutzpah.json:

{
  "Framework": "jasmine",
  "RootReferencePathMode": "SettingsFileDirectory",
  "Engine": "JSDom",
  "Compile": {
    "Mode": "External",
    "Extensions": [ ".ts" ],
    "ExtensionsWithNoOutput": [ ".d.ts" ]
  },
  "References": [
    {
      "Path": "wwwroot/lib/typescript/typescript.js",
      "IsTestFrameworkFile": true
    },
    {
      "Path": "wwwroot/lib/jquery/jquery.min.js",
      "IsTestFrameworkFile": true
    },
    {
      "Path": "wwwroot/lib/jasmine/jasmine.js",
      "IsTestFrameworkFile": true
    },
    {
      "Path": "wwwroot/lib/jasmine/jasmine-html.js",
      "IsTestFrameworkFile": true
    },
    {
      "Path": "wwwroot/lib/jasmine/boot.js",
      "IsTestFrameworkFile": true
    },
    {
      "Path": "wwwroot/lib/jasmine-jquery/jasmine-jquery.js",
      "IsTestFrameworkFile": true
    }
  ],
  "Tests": [
    {
      "Path": "_out", "Includes": ["sample.tests.js"]
    }
  ]
}

Test file (sample.tests.ts):

import "jasmine";

describe('SAMPLE', () => {
    let myNumber: number;

    beforeEach(() => {
        myNumber = 9266;
    });

    it('gets number', () => {
        expect(myNumber).toBe(9266);
    });

    it('gets added number', () => {
        expect(myNumber + 90210).toBe(9266 + 90210);
    });

    it('resets number', () => {
        myNumber = 42;
        expect(myNumber).toBe(42);
    });

    it('resets number and adds', () => {
        myNumber = 42;
        expect(myNumber + 600).toBe(642);
    });

    it('resets number 1337', () => {
        myNumber = 1337;
        expect(myNumber).toBe(1337);
    });
});

Directory layout:

Directory layout in VS 2022

I've tried a bunch of different configurations, and nothing has gotten these simple tests to show in the Test Explorer. Anyone have insight as to what I'm configuring incorrectly?

0

There are 0 best solutions below