Skip to content

Commit 2ea43c8

Browse files
author
Matthew Wolff
committed
hardcoding test import paths for yarn test
1 parent 351d102 commit 2ea43c8

5 files changed

Lines changed: 6 additions & 8 deletions

File tree

.github/workflows/yarn.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ jobs:
2020
uses: borales/actions-yarn@v5
2121
with:
2222
cmd: test # will run `yarn test` command
23+
env:
24+
GITHUB_TEST: true

__tests__/interactionHandler.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ describe('InteractionHandler', () => {
5151
}
5252
} as unknown as Client;
5353

54-
const { InteractionHandler: RealHandler } = jest.requireActual('@/handler/interactionHandler');
54+
const { InteractionHandler: RealHandler } = jest.requireActual(
55+
`${process.env.GITHUB_TEST ? 'src' : '../src'}/handler/interactionHandler`
56+
);
5557
handler = new RealHandler(mockClient);
5658
});
5759

__tests__/presenceUpdateHandler.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ActivityType } from 'discord-api-types/v10';
44
import { GameDatabase } from '../src/model';
55

66
jest.mock('discord.js');
7-
jest.mock('@/model/gameDatabase');
7+
jest.mock(`${process.env.GITHUB_TEST ? 'src' : '../src'}/model/gameDatabase`);
88

99
const mockMessage = { content: 'Test message' } as Message;
1010
const mockSend = jest.fn().mockResolvedValue(mockMessage);

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
"jest": {
1616
"preset": "ts-jest",
1717
"testEnvironment": "node",
18-
"moduleDirectories": ["node_modules", "src"],
19-
"moduleNameMapper": {
20-
"^@/(.*)$": "<rootDir>/src/$1"
21-
},
2218
"moduleFileExtensions": [
2319
"ts",
2420
"js",

tsconfig.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
22
"compilerOptions": {
3-
"baseUrl": ".",
4-
"paths": { "@/*": ["src/*"] },
53
"experimentalDecorators": true, // Enable experimental support for TypeScript decorators
64
"skipLibCheck": true, // Skip type checking of declaration files (*.d.ts)
75
"target": "es6", // Specify the ECMAScript target version (ES6 in this case)

0 commit comments

Comments
 (0)