Browse Source

jest tests back + vscode

pull/21/head
Coin de Gamma 4 years ago
parent
commit
41bb85c984
  1. 1
      .gitignore
  2. 20
      .vscode/launch.json
  3. 2
      bin.tsconfig.json
  4. 26
      jest.config.js
  5. 2
      package.json
  6. 4
      spec/elasticsearch.jest.ts
  7. 3
      tsconfig.jest.json

1
.gitignore vendored

@ -2,6 +2,5 @@ dist/
dist-test/
node_modules/
npm-debug.log
.vscode/
lib/
bin/

20
.vscode/launch.json vendored

@ -0,0 +1,20 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest All",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"--runInBand"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
}
}
]
}

2
bin.tsconfig.json

@ -6,5 +6,5 @@
"outFile": "bin/tsdb-kit.js"
},
"include": [ "src/**/*.ts" ],
"exclude": [ "src/index.ts" ]
"exclude": [ "src/index.ts" ]
}

26
jest.config.js

@ -1,21 +1,11 @@
module.exports = {
"verbose": true,
"globals": {
"ts-jest": {
"useBabelrc": true,
"tsConfigFile": "tsconfig.jest.json"
}
},
"transform": {
"\\.ts": "ts-jest"
},
"testRegex": "(\\.|/)([jt]est)\\.[jt]s$",
"moduleFileExtensions": [
"ts",
"js",
"json"
],
"setupFiles": [
verbose: true,
preset: 'ts-jest',
testEnvironment: 'node',
setupFiles: [
"<rootDir>/spec/setup_tests.ts"
]
],
// TODO: folder structure defualt for jest, so
// no preference about the testRegex
testRegex: "(\\.|/)([jt]est)\\.[jt]s$"
};

2
package.json

@ -7,7 +7,7 @@
"build:lib": "tsc --p lib.tsconfig.json",
"build:bin": "tsc --p bin.tsconfig.json",
"dev": "tsc -w",
"test": "ts-jest"
"test": "jest "
},
"repository": {
"type": "git",

4
spec/elasticsearch.jest.ts

@ -179,7 +179,9 @@ describe('simple query', function(){
let limit = 222;
let offset = 333;
expect(elasticMetric.getQuery(from, to, limit, offset)).toEqual(expectedQuery);
let result = elasticMetric.getQuery(from, to, limit, offset);
expect(result).toEqual(expectedQuery);
});

3
tsconfig.jest.json

@ -1,3 +0,0 @@
{
"extends": "./tsconfig"
}
Loading…
Cancel
Save