Skip to content

Commit a8b35d9

Browse files
committed
add aliasing to jest config
1 parent 81a6985 commit a8b35d9

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

jest.config.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,19 @@ module.exports = {
1313
'^.+\\.vue$': 'vue-jest'
1414
},
1515
testMatch: ['**/test/**/*.test.js?(x)'],
16-
modulePathIgnorePatterns: ["test/e2e/screenshot.test.js"] // Don't run this file in npm test
16+
moduleNameMapper: {
17+
'^~/(.+)$': '<rootDir>/src/$1',
18+
},
19+
modulePathIgnorePatterns: ['test/e2e/screenshot.test.js'] // Don't run this file in npm test
1720
},
1821
{
1922
displayName: 'node',
2023
preset: 'ts-jest',
2124
testEnvironment: 'node',
2225
testMatch: ['**/test/**/*.test.node.js?(x)'],
26+
moduleNameMapper: {
27+
'^~/(.+)$': '<rootDir>/src/$1',
28+
}
2329
}
24-
],
30+
]
2531
};

test/unit/NewReleaseNotification.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { shallowMount } from '@vue/test-utils';
2-
import NewReleaseNotification from '../../src/components/NewReleaseNotification';
2+
import NewReleaseNotification from '~/components/NewReleaseNotification';
33

44
describe('hasNewRelease method', () => {
55
const wrapper = shallowMount(NewReleaseNotification, {

test/unit/classes.test.node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const classes = require('../../src/util/classes');
1+
const classes = require('~/util/classes');
22

33
const testClasses = [
44
{ name: ['Test', 'Subtest'], rule: { type: 'regex', pattern: 'test' } },

0 commit comments

Comments
 (0)