Skip to content

Commit

Permalink
Tests: Import module by name [refactor]
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Jun 18, 2020
1 parent c5956e6 commit 17af070
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ module.exports = {
testEnvironment: 'node',
coverageDirectory: 'coverage',
collectCoverageFrom: ['index.js', 'lib/**/*.js'],
setupFilesAfterEnv: ['jest-extended']
setupFilesAfterEnv: ['jest-extended'],
moduleNameMapper: {
'^@overlookmotel/eslint-config-node$': '<rootDir>/index.js'
}
};
6 changes: 5 additions & 1 deletion test/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
module.exports = {
extends: [
'@overlookmotel/eslint-config-jest'
]
],
rules: {
'import/no-unresolved': ['error', {ignore: ['^@overlookmotel/eslint-config-node$']}],
'node/no-missing-require': ['error', {allowModules: ['@overlookmotel/eslint-config-node']}]
}
};
2 changes: 1 addition & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'use strict';

// Modules
const eslintConfigNode = require('../index.js');
const eslintConfigNode = require('@overlookmotel/eslint-config-node');

// Tests

Expand Down

0 comments on commit 17af070

Please sign in to comment.