Closed joey-he8x closed 6 years ago
Please provide a debug log.
do u mean adding --debug?
{
"configs": [
{
"automock": false,
"browser": false,
"cache": true,
"cacheDirectory": "/var/folders/p5/75zf43bs7t7fm06y4nbcgpnh0000gq/T/jest_dz",
"clearMocks": false,
"coveragePathIgnorePatterns": [
"/node_modules/"
],
"detectLeaks": false,
"forceCoverageMatch": [],
"globals": {
"ts-jest": {
"tsConfigFile": "tsconfig.json"
}
},
"haste": {
"providesModuleNodeModules": []
},
"moduleDirectories": [
"node_modules"
],
"moduleFileExtensions": [
"ts",
"js",
"node",
"json"
],
"moduleNameMapper": {},
"modulePathIgnorePatterns": [],
"name": "71a650be7f2368588dd22dc01c974b15",
"resetMocks": false,
"resetModules": false,
"restoreMocks": false,
"rootDir": "/Users/moge/ts-jest-issue",
"roots": [
"/Users/ts-jest-issue"
],
"runner": "jest-runner",
"setupFiles": [],
"snapshotSerializers": [],
"testEnvironment": "/Users/moge/ts-jest-issue/node_modules/jest-environment-node/build/index.js",
"testEnvironmentOptions": {},
"testLocationInResults": false,
"testMatch": [
"**/test/**/*.test.(ts|js)"
],
"testPathIgnorePatterns": [
"/node_modules/"
],
"testRegex": "",
"testRunner": "/Users/moge/ts-jest-issue/node_modules/jest-jasmine2/build/index.js",
"testURL": "about:blank",
"timers": "real",
"transform": [
[
"^.+\\.(ts|tsx)$",
"/Users/moge/ts-jest-issue/node_modules/ts-jest/preprocessor.js"
]
],
"transformIgnorePatterns": [
"/node_modules/"
],
"watchPathIgnorePatterns": []
}
],
"globalConfig": {
"bail": false,
"changedFilesWithAncestor": false,
"coverageDirectory": "/Users/moge/ts-jest-issue/coverage",
"coverageReporters": [
"json",
"text",
"lcov",
"clover"
],
"detectLeaks": false,
"expand": false,
"globalSetup": null,
"globalTeardown": null,
"listTests": false,
"maxWorkers": 3,
"noStackTrace": false,
"nonFlagArgs": [],
"notify": false,
"notifyMode": "always",
"passWithNoTests": false,
"rootDir": "/Users/moge/ts-jest-issue",
"runTestsByPath": false,
"testFailureExitCode": 1,
"testPathPattern": "",
"testResultsProcessor": null,
"updateSnapshot": "new",
"useStderr": false,
"verbose": null,
"watch": false,
"watchman": true
},
"version": "22.4.2"
}
FAIL test/main.test.ts
● Test suite failed to run
Cannot find module 'web3/types' from 'main.ts'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:169:17)
at Object.<anonymous> (src/main.ts:20:17)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 0.694s
Ran all test suites.
@joey-he8x removing "emitDecoratorMetadata": true,
from tsconfig fixes this. Does that work for you?
but i use inversify.js which requires emitDecoratorMetadata to be true.
You can extends
tsconfig, override this field and use that tsconfig for testing
@joey-he8x does extending tsconfig work for you?
Hi, same error! Here my repo https://github.com/pyoner/vue-firebase-plugin Output log
➜ vue-firebase-plugin git:(master) npm run test
> vue-firebase-plugin@0.0.0-development test /home/jungle/repo/vue-firebase-plugin
> jest --debug
{
"configs": [
{
"automock": false,
"browser": false,
"cache": true,
"cacheDirectory": "/tmp/jungle/jest_rs",
"clearMocks": false,
"coveragePathIgnorePatterns": [
"/node_modules/",
"/test/"
],
"detectLeaks": false,
"forceCoverageMatch": [],
"globals": {
"ts-jest": {
"tsConfigFile": "tsconfig.jest.json"
}
},
"haste": {
"providesModuleNodeModules": []
},
"moduleDirectories": [
"node_modules"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"moduleNameMapper": {},
"modulePathIgnorePatterns": [],
"name": "1783d1d0b16c3cb9fb9c25becff38ac8",
"resetMocks": false,
"resetModules": false,
"restoreMocks": false,
"rootDir": "/home/jungle/repo/vue-firebase-plugin",
"roots": [
"/home/jungle/repo/vue-firebase-plugin"
],
"runner": "jest-runner",
"setupFiles": [],
"snapshotSerializers": [],
"testEnvironment": "jest-environment-jsdom",
"testEnvironmentOptions": {},
"testLocationInResults": false,
"testMatch": [],
"testPathIgnorePatterns": [
"/node_modules/"
],
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
"testRunner": "/home/jungle/repo/vue-firebase-plugin/node_modules/jest/node_modules/jest-jasmine2/build/index.js",
"testURL": "about:blank",
"timers": "real",
"transform": [
[
"^.+\\.tsx?$",
"/home/jungle/repo/vue-firebase-plugin/node_modules/ts-jest/index.js"
]
],
"transformIgnorePatterns": [
"/node_modules/"
],
"watchPathIgnorePatterns": []
}
],
"globalConfig": {
"bail": false,
"changedFilesWithAncestor": false,
"collectCoverage": true,
"coverageDirectory": "/home/jungle/repo/vue-firebase-plugin/coverage",
"coverageReporters": [
"json",
"text",
"lcov",
"clover"
],
"coverageThreshold": {
"global": {
"branches": 90,
"functions": 95,
"lines": 95,
"statements": 95
}
},
"detectLeaks": false,
"expand": false,
"globalSetup": null,
"globalTeardown": null,
"listTests": false,
"maxWorkers": 3,
"noStackTrace": false,
"nonFlagArgs": [],
"notify": false,
"notifyMode": "always",
"passWithNoTests": false,
"rootDir": "/home/jungle/repo/vue-firebase-plugin",
"runTestsByPath": false,
"testFailureExitCode": 1,
"testPathPattern": "",
"testResultsProcessor": null,
"updateSnapshot": "new",
"useStderr": false,
"verbose": null,
"watch": false,
"watchman": true
},
"version": "22.4.2"
}
FAIL test/vue-firebase-plugin.test.ts
● Test suite failed to run
Cannot find module '@firebase/firestore-types' from 'Firestore.ts'
17 | StartEnd,
18 | CreateRef
> 19 | } from '../utils'
20 |
21 | interface Inner {
22 | unsubscribe?: () => void
at Resolver.resolveModule (node_modules/jest/node_modules/jest-resolve/build/index.js:169:17)
at Object.<anonymous> (src/components/Firestore.ts:19:49)
FAIL test/Firestore.test.ts
● Test suite failed to run
Cannot find module '@firebase/firestore-types' from 'Firestore.ts'
17 | StartEnd,
18 | CreateRef
> 19 | } from '../utils'
20 |
21 | interface Inner {
22 | unsubscribe?: () => void
at Resolver.resolveModule (node_modules/jest/node_modules/jest-resolve/build/index.js:169:17)
at Object.<anonymous> (src/components/Firestore.ts:19:49)
FAIL test/utils.test.ts
● Test suite failed to run
Cannot find module '@firebase/firestore-types' from 'utils.ts'
88 | return value.toDate()
89 | }
> 90 |
91 | if (value instanceof GeoPoint) {
92 | return {
93 | latitude: value.latitude,
at Resolver.resolveModule (node_modules/jest/node_modules/jest-resolve/build/index.js:169:17)
at Object.<anonymous> (src/utils.ts:90:284)
----------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
----------|----------|----------|----------|----------|----------------|
All files | Unknown | Unknown | Unknown | Unknown | |
----------|----------|----------|----------|----------|----------------|
Jest: Coverage data for global was not found.
Test Suites: 3 failed, 3 total
Tests: 0 total
Snapshots: 0 total
Time: 4.429s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-firebase-plugin@0.0.0-development test: `jest --debug`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-firebase-plugin@0.0.0-development test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/jungle/.npm/_logs/2018-05-22T09_52_22_848Z-debug.log
Please open a new issue and link to the old one :)
run with jest, got error :Cannot find module 'web3/types' from 'main.ts'
if i remove decorator from main.ts, then no errors.
if i add 'd.ts' into moduleFileExtensions,
checkout https://github.com/joey-he8x/ts-jest-issue npm run test