Browse Source

jest tests back + vscode

pull/21/head
Coin de Gamma 3 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/ dist-test/
node_modules/ node_modules/
npm-debug.log npm-debug.log
.vscode/
lib/ lib/
bin/ 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" "outFile": "bin/tsdb-kit.js"
}, },
"include": [ "src/**/*.ts" ], "include": [ "src/**/*.ts" ],
"exclude": [ "src/index.ts" ] "exclude": [ "src/index.ts" ]
} }

26
jest.config.js

@ -1,21 +1,11 @@
module.exports = { module.exports = {
"verbose": true, verbose: true,
"globals": { preset: 'ts-jest',
"ts-jest": { testEnvironment: 'node',
"useBabelrc": true, setupFiles: [
"tsConfigFile": "tsconfig.jest.json"
}
},
"transform": {
"\\.ts": "ts-jest"
},
"testRegex": "(\\.|/)([jt]est)\\.[jt]s$",
"moduleFileExtensions": [
"ts",
"js",
"json"
],
"setupFiles": [
"<rootDir>/spec/setup_tests.ts" "<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:lib": "tsc --p lib.tsconfig.json",
"build:bin": "tsc --p bin.tsconfig.json", "build:bin": "tsc --p bin.tsconfig.json",
"dev": "tsc -w", "dev": "tsc -w",
"test": "ts-jest" "test": "jest "
}, },
"repository": { "repository": {
"type": "git", "type": "git",

4
spec/elasticsearch.jest.ts

@ -179,7 +179,9 @@ describe('simple query', function(){
let limit = 222; let limit = 222;
let offset = 333; 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