console-fail-test
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -84,1 +84,17 @@ # Development | ||
See [`src/spies/jest.ts`](../src/spies/jest.ts) as an example. | ||
## Unit Tests | ||
This repository uses [Vitest](https://vitest.dev) for a small amount of unit test coverage. | ||
You can run it locally on the command-line: | ||
```shell | ||
pnpm run test | ||
``` | ||
Test environments and spy frameworks don't need to be unit tested just yet. | ||
### Debugging Tests | ||
This repository includes a [VS Code launch configuration](https://code.visualstudio.com/docs/editor/debugging) for debugging unit tests. | ||
To launch it, open a test file, then run _Debug Current Test File_ from the VS Code Debug panel (or press F5). |
@@ -17,3 +17,4 @@ { | ||
"pretty-quick": "^3.1.3", | ||
"typescript": "^4.7.4" | ||
"typescript": "^4.7.4", | ||
"vitest": "^0.31.0" | ||
}, | ||
@@ -47,5 +48,6 @@ "main": "src/index.js", | ||
"lint:spelling": "cspell \"**\" \".github/**/*\"", | ||
"prepare": "husky install" | ||
"prepare": "husky install", | ||
"test": "vitest" | ||
}, | ||
"version": "0.2.1" | ||
"version": "0.2.2" | ||
} |
@@ -17,3 +17,3 @@ "use strict"; | ||
exports.formatComplaintLineWithIndex = formatComplaintLineWithIndex; | ||
const formatComplaintCall = (call) => call.map(exports.formatComplaintLineArg).join(", "); | ||
const formatComplaintCall = (call) => call.args.map(exports.formatComplaintLineArg).join(", "); | ||
exports.formatComplaintCall = formatComplaintCall; | ||
@@ -33,4 +33,4 @@ const formatComplaintLineArg = (arg) => { | ||
methodComplaints: methodsWithCalls.map(([methodName, methodCalls]) => ({ | ||
methodName, | ||
methodCalls, | ||
methodName, | ||
})), | ||
@@ -37,0 +37,0 @@ }; |
@@ -10,21 +10,18 @@ "use strict"; | ||
const nodeTap_1 = require("./nodeTap"); | ||
const vitest_1 = require("./vitest"); | ||
const testEnvironmentsByName = new Map([ | ||
["jasmine", jasmine_1.selectJasmineEnvironment], | ||
["jest", jest_1.selectJestEnvironment], | ||
["mocha", mocha_1.selectMochaEnvironment], | ||
["vitest", vitest_1.selectVitestEnvironment], | ||
["mocha", mocha_1.getMochaEnvironment], | ||
["jest", jest_1.getJestEnvironment], | ||
["jasmine", jasmine_1.getJasmineEnvironment], | ||
]); | ||
const detectableTestEnvironmentGetters = [ | ||
// These environments only work with received modules, so they should come first | ||
ava_1.selectAvaEnvironment, | ||
lab_1.selectLabEnvironment, | ||
nodeTap_1.selectNodeTapEnvironment, | ||
vitest_1.selectVitestEnvironment, | ||
ava_1.getAvaEnvironment, | ||
lab_1.getLabEnvironment, | ||
nodeTap_1.getNodeTapEnvironment, | ||
// Jest should come before Jasmine because Jest includes a monkey-patched Jasmine | ||
jest_1.selectJestEnvironment, | ||
jasmine_1.selectJasmineEnvironment, | ||
jest_1.getJestEnvironment, | ||
jasmine_1.getJasmineEnvironment, | ||
// Mocha should be last because it's difficult to accurately detect | ||
// See https://github.com/JoshuaKGoldberg/console-fail-test/issues/10 | ||
mocha_1.selectMochaEnvironment, | ||
mocha_1.getMochaEnvironment, | ||
]; | ||
@@ -44,6 +41,2 @@ const selectTestEnvironment = (request) => { | ||
} | ||
// If a test environment is provided, use it directly | ||
if (request.testFramework) { | ||
return request.testFramework; | ||
} | ||
// Otherwise, attempt to auto-detect an active one | ||
@@ -50,0 +43,0 @@ for (const testEnvironmentGetter of detectableTestEnvironmentGetters) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
483176
74
811
13