Skip to content

Commit

Permalink
chore(tests): move tests under src folder to fix jest issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jafin committed Apr 3, 2022
1 parent ed0f4f8 commit 7faad40
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
17 changes: 13 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
module.exports = {
// The root of your source code, typically /src
// `<rootDir>` is a token Jest substitutes
roots: ['<rootDir>/test'],
roots: ['<rootDir>'],

// Jest transformations -- this adds support for TypeScript
// using ts-jest
verbose: true,
globals: {
'ts-jest': {
diagnostics: {
warnOnly: true
}
}
},

// Jest transformations -- this adds support for TypeScript using ts-jest
transform: {
'^.+\\.tsx?$': 'ts-jest',
'^.+\\.scss$': 'jest-scss-transform'
Expand All @@ -24,5 +32,6 @@ module.exports = {
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',

// Module file extensions for importing
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node']
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
preset: 'ts-jest'
};
2 changes: 1 addition & 1 deletion test/index.spec.tsx → src/__tests__/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @jest-environment jsdom
*/
import React from 'react';
import ReactTooltip from '../src/index';
import ReactTooltip from '../index';
import { render, cleanup } from '@testing-library/react';
import forEach from 'mocha-each';

Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"outDir": "./out-tsc",
"allowJs": true,
"target": "es2018",
// "types": ["node","jest"],
"module": "esnext",
"moduleResolution": "node",
"noImplicitAny": false,
Expand Down

0 comments on commit 7faad40

Please sign in to comment.