Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
832 views
in Technique[技术] by (71.8m points)

typescript - Jasmine/VSCode - No specs found

I've got a Typescript Node app I'm trying to get Jasmine working with and also able to debug the tests in VSCode. I'm following this tutorial: https://medium.com/@RupaniChirag/writing-unit-tests-in-typescript-d4719b8a0a40

In my project root I've got src with all my project files in, and spec, which contains a single file relevance-engine.spec.ts, as well as my jasmine.json which is

{
  "spec_dir": "spec",
  "spec_files": ["/*[sS]pec.ts"]
}

My VSCode launch configuration is

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [ 
        {
            "type": "node",
            "request": "launch",
            "name": "Jasmine Current File",
            "program": "${workspaceFolder}/node_modules/jasmine/bin/jasmine",
            "args": [
              "${workspaceFolder}/TSOutput/spec/${fileBasenameNoExtension}.js"
            ],
            "preLaunchTask": "tsc: build - tsconfig.json",     
            "outFiles": ["${workspaceFolder}/TSOutput/**/*.js"],
            "console": "integratedTerminal",
            "internalConsoleOptions": "neverOpen"
      }
    ]
}

Package.json scripts

"scripts": {
    "build": "tsc",
    "prestart": "npm run build",
    "start": "node .",
    "test": "ts-node node_modules/jasmine/bin/jasmine --config=jasmine.json"
  },

As Jasmine output I get

Debugger attached.
Randomized with seed 28827
Started


No specs found
Finished in 0.005 seconds
Incomplete: No specs found
Randomized with seed 28827 (jasmine --random=true --seed=28827)
Waiting for the debugger to disconnect...

Package versions:

[email protected]
[email protected]
question from:https://stackoverflow.com/questions/65836384/jasmine-vscode-no-specs-found

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...