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. 26
      jest.config.js
  4. 2
      package.json
  5. 4
      spec/elasticsearch.jest.ts
  6. 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",
}
}
]
}

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