mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-11 20:02:09 +00:00
Add vitest inside TypeScript
This commit is contained in:
parent
820e796fd8
commit
95a5db2080
@ -1,5 +1,5 @@
|
|||||||
import { pathsToModuleNameMapper } from "ts-jest/utils";
|
import { pathsToModuleNameMapper } from "ts-jest";
|
||||||
const { compilerOptions } = require("./tsconfig");
|
import { compilerOptions } from './tsconfig.json'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
roots: ['<rootDir>/app', '<rootDir>/test/jest'],
|
roots: ['<rootDir>/app', '<rootDir>/test/jest'],
|
||||||
|
|||||||
11723
TypeScript/package-lock.json
generated
11723
TypeScript/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -8,24 +8,28 @@
|
|||||||
"pretest": "rimraf app/**/*.js test/**/*.js",
|
"pretest": "rimraf app/**/*.js test/**/*.js",
|
||||||
"test:jest": "jest",
|
"test:jest": "jest",
|
||||||
"test:jest:watch": "jest --watchAll",
|
"test:jest:watch": "jest --watchAll",
|
||||||
"test:mocha": "nyc mocha"
|
"test:mocha": "nyc mocha",
|
||||||
|
"test:vitest": "vitest --coverage"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": true,
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chai": "^4.2.22",
|
"@types/chai": "^4.2.22",
|
||||||
"@types/jest": "^27.0.2",
|
"@types/jest": "^29.4.0",
|
||||||
"@types/mocha": "^9.0.0",
|
"@types/mocha": "^10.0.1",
|
||||||
"@types/node": "^16.11.7",
|
"@types/node": "^18.14.0",
|
||||||
|
"@vitest/coverage-istanbul": "^0.28.5",
|
||||||
"chai": "^4.3.4",
|
"chai": "^4.3.4",
|
||||||
"jest": "^27.3.1",
|
"jest": "^29.4.3",
|
||||||
"mocha": "^9.1.3",
|
"mocha": "^10.2.0",
|
||||||
"nyc": "~15.1.0",
|
"nyc": "~15.1.0",
|
||||||
"rimraf": "~3.0.2",
|
"rimraf": "^4.1.2",
|
||||||
"source-map-support": "^0.5.20",
|
"source-map-support": "^0.5.20",
|
||||||
"ts-jest": "^27.0.7",
|
"ts-jest": "^29.0.5",
|
||||||
"ts-node": "^10.4.0",
|
"ts-node": "^10.9.1",
|
||||||
"tsconfig-paths": "^3.11.0",
|
"tsconfig-paths": "^4.1.2",
|
||||||
"typescript": "^4.4.4"
|
"typescript": "^4.4.4",
|
||||||
|
"vite-tsconfig-paths": "^4.0.5",
|
||||||
|
"vitest": "^0.28.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
9
TypeScript/test/vitest/gilded-rose.spec.ts
Normal file
9
TypeScript/test/vitest/gilded-rose.spec.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { Item, GildedRose } from '@/gilded-rose';
|
||||||
|
|
||||||
|
describe('Gilded Rose', () => {
|
||||||
|
it('should foo', () => {
|
||||||
|
const gildedRose = new GildedRose([new Item('foo', 0, 0)]);
|
||||||
|
const items = gildedRose.updateQuality();
|
||||||
|
expect(items[0].name).toBe('fixme');
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -6,6 +6,8 @@
|
|||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
"baseUrl": "./",
|
"baseUrl": "./",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": [
|
"@/*": [
|
||||||
"app/*"
|
"app/*"
|
||||||
|
|||||||
14
TypeScript/vitest.config.ts
Normal file
14
TypeScript/vitest.config.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import {defineConfig} from 'vitest/config';
|
||||||
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [tsconfigPaths()],
|
||||||
|
test: {
|
||||||
|
globals: true,
|
||||||
|
include: ['test/vitest/**/*.{spec,test}.{js,ts}'],
|
||||||
|
coverage: {
|
||||||
|
provider: 'istanbul',
|
||||||
|
reporter: ['text', 'html']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user