Skip to content

Commit

Permalink
(refactor): move tests to test/, test-utils/ to test/config/
Browse files Browse the repository at this point in the history
- have been putting tests separately from source nowadays in other of
  my libraries, so standardize around that

- put fixtures just in test/ (later could be in test/fixtures/), leave
  config/ solely for test config type things
  • Loading branch information
agilgur5 committed Feb 10, 2022
1 parent 25ff907 commit f6e60d0
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
module.exports = {
moduleNameMapper: {
// allow importing of Jest as an ES Module (https://github.com/facebook/jest/pull/7571#issuecomment-498634094)
'^jest$': '<rootDir>/test-utils/jest-export.js'
'^jest$': '<rootDir>/test/config/jest-export.js'
},
setupFilesAfterEnv: [
// configure enzyme w/ react adapter
'<rootDir>/test-utils/configure-enzyme.js',
'<rootDir>/test/config/configure-enzyme.js',
// polyfill window.resizeTo
'<rootDir>/test-utils/window-resizeTo.js'
'<rootDir>/test/config/window-resizeTo.js'
],
transform: {
// use babel-jest@23 for babel@6 support (https://github.com/facebook/jest/issues/8230#issuecomment-479470547)
'\\.js$': require.resolve('babel-jest')
},
coveragePathIgnorePatterns: [
'/node_modules/', // default
'<rootDir>/test-utils/' // ignore test-utils
'<rootDir>/test/' // ignore any test helper files
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "A React wrapper component around signature_pad. Unopinionated and heavily updated fork of react-signature-pad",
"main": "build/index.js",
"files": [
"src/index.js",
"src/",
"build/"
],
"author": "Anton Gilgur",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/index.spec.js → test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import jest, { describe, it, test, expect } from 'jest'
import { mount } from 'enzyme'
import React from 'react'

import SignatureCanvas from './index.js'
import { propsF, dotF } from '../test-utils/fixtures.js'
import SignatureCanvas from '../src/index.js'
import { propsF, dotF } from './fixtures.js'

test('mounts canvas and instance properly', () => {
const wrapper = mount(<SignatureCanvas />)
Expand Down

0 comments on commit f6e60d0

Please sign in to comment.