Skip to content

Commit e24be5f

Browse files
authored
#4 - Added alias to src for tests (#6)
* #4 - Added alias * #4 - updated lock version
1 parent 12a2e8e commit e24be5f

File tree

8 files changed

+22
-9
lines changed

8 files changed

+22
-9
lines changed

jest.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
const { pathsToModuleNameMapper } = require('ts-jest/utils');
2+
const { compilerOptions } = require('./tsconfig.json');
3+
4+
/** @typedef {import('ts-jest/dist/types')} */
5+
/** @type {import('@jest/types').Config.InitialOptions} */
16
module.exports = {
27
preset: 'ts-jest',
38
testEnvironment: 'jsdom',
49
rootDir: './',
510
transform: {
611
'^.+\\.[t]sx?$': 'ts-jest'
712
},
13+
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/' }),
814
collectCoverageFrom: [
915
'<rootDir>/src/**/*.ts',
1016
'!<rootDir>/src/index.ts'

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vacl",
3-
"version": "0.1.3",
3+
"version": "0.1.4",
44
"description": "A Lightweight Typescript ACL directives library for Vue 3",
55
"files": [
66
"dist"

rollup.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import typescript from 'rollup-plugin-typescript2';
22
import pkg from './package.json';
33
import { terser } from 'rollup-plugin-terser';
44
import bundleSize from 'rollup-plugin-bundle-size';
5+
import path from "path";
56

67
export default {
78
input: 'src/index.ts',
@@ -20,6 +21,9 @@ export default {
2021
external: [
2122
...Object.keys(pkg.dependencies || {})
2223
],
24+
alias: {
25+
'@/': path.resolve(__dirname, '/src/')
26+
},
2327
plugins: [
2428
typescript({
2529
typescript: require('typescript'),

tests/unit/ACL.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ACL from '../../src/lib/ACL';
1+
import ACL from '@/lib/ACL';
22

33
describe('aCL', () => {
44
it('can_be_instantiated', () => {

tests/vue/ACL.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { mount } from '@vue/test-utils';
22
import { createApp, h } from 'vue';
3-
import ACL from '../../src/lib/ACL';
4-
import Vacl from '../../src/index';
3+
import ACL from '@/lib/ACL';
4+
import Vacl from '@/index';
55

66
describe('reactivity', () => {
77
it('can be installed correctly', () => {

tests/vue/Directives.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { VueWrapper } from '@vue/test-utils';
22
import { mount } from '@vue/test-utils';
3-
import ACL from '../../src/lib/ACL';
4-
import { can, cannot, has, hasnt } from '../../src/lib/Directives';
3+
import ACL from '@/lib/ACL';
4+
import { can, cannot, has, hasnt } from '@/lib/Directives';
55

66
/******************************************************************************
77
* PERMISSIONS

tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
"declaration": true,
44
"declarationDir": "types",
55
"declarationMap": true,
6-
6+
"baseUrl": "./",
7+
"paths": {
8+
"@/*": ["src/*"]
9+
},
710
"module": "ES2015",
811
"rootDir": "src",
912
"preserveConstEnums": false,

0 commit comments

Comments
 (0)