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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…