mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Configure Jest Testing Framework for Typescript (#2519)
* Set JEST for Typescript testing * tests
This commit is contained in:
parent
fa83ce10a3
commit
6a390aedbc
17
jest.config.js
vendored
Normal file
17
jest.config.js
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
module.exports = {
|
||||
"roots": [
|
||||
"resources/js/src"
|
||||
],
|
||||
"transform": {
|
||||
"^.+\\.tsx?$": "ts-jest"
|
||||
},
|
||||
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
|
||||
"moduleFileExtensions": [
|
||||
"ts",
|
||||
"tsx",
|
||||
"js",
|
||||
"jsx",
|
||||
"json",
|
||||
"node"
|
||||
],
|
||||
}
|
@ -7,18 +7,21 @@
|
||||
"watch-poll": "npm run watch -- --watch-poll",
|
||||
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||
"prod": "npm run production",
|
||||
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
|
||||
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||
"test": "jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@coreui/coreui": "^2.0.12",
|
||||
"@coreui/coreui-plugin-chartjs-custom-tooltips": "1.2.0",
|
||||
"@coreui/icons": "^0.3.0",
|
||||
"@types/jest": "^23.3.9",
|
||||
"axios": "^0.18",
|
||||
"bootstrap": "^4.0.0",
|
||||
"chart.js": "^2.7.2",
|
||||
"cross-env": "^5.1",
|
||||
"flag-icon-css": "3.2.0",
|
||||
"font-awesome": "^4.7",
|
||||
"jest": "^23.6.0",
|
||||
"jquery": "^3.2",
|
||||
"laravel-mix": "^2.0",
|
||||
"lodash": "^4.17.5",
|
||||
@ -26,9 +29,11 @@
|
||||
"perfect-scrollbar": "1.4.0",
|
||||
"popper.js": "^1.12",
|
||||
"simple-line-icons": "2.4.1",
|
||||
"ts-jest": "^23.10.5",
|
||||
"vue": "^2.5.17"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "^10.12.10",
|
||||
"hashids": "^1.2.2",
|
||||
"laravel-echo": "^1.4.0",
|
||||
"quill": "^1.3.6",
|
||||
|
2
public/js/client_edit.js
vendored
2
public/js/client_edit.js
vendored
File diff suppressed because one or more lines are too long
3
resources/js/src/tests/math.ts
Normal file
3
resources/js/src/tests/math.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export function sum(x: number, y: number): number {
|
||||
return x + y;
|
||||
}
|
13
resources/js/src/tests/test.test.ts
Normal file
13
resources/js/src/tests/test.test.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { sum } from "./math";
|
||||
|
||||
describe("This is a simple test", () => {
|
||||
test("Check the sum of 0 + 0", () => {
|
||||
expect(sum(0,0)).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("This is a simple test", () => {
|
||||
test("Check the sum of 1 + 2", () => {
|
||||
expect(sum(1, 2)).toBe(3);
|
||||
});
|
||||
});
|
@ -57,6 +57,6 @@
|
||||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||
},
|
||||
"include": [
|
||||
"resources/js/ts/**/*"
|
||||
"resources/js/src/**/*"
|
||||
]
|
||||
}
|
2
webpack.mix.js
vendored
2
webpack.mix.js
vendored
@ -25,7 +25,7 @@ mix.webpackConfig({
|
||||
}
|
||||
});
|
||||
|
||||
mix.js('resources/js/ts/client/client_edit.ts', 'public/js');
|
||||
mix.js('resources/js/src/client/client_edit.ts', 'public/js');
|
||||
|
||||
mix.js('resources/js/app.js', 'public/js/vendor');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user