mirror of
https://github.com/pieartsy/PluralFlux.git
synced 2026-04-16 17:45:28 +10:00
updated jest to sort of work with es6
This commit is contained in:
12
package.json
12
package.json
@@ -22,15 +22,21 @@
|
|||||||
"jest": "^30.2.0"
|
"jest": "^30.2.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest"
|
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"testEnvironment": "node",
|
"testEnvironment": "node",
|
||||||
"coveragePathIgnorePatterns": [
|
"coveragePathIgnorePatterns": [
|
||||||
"/node_modules/"
|
"/node_modules/"
|
||||||
],
|
],
|
||||||
"moduleFileExtensions": ["js", "json"],
|
"moduleFileExtensions": [
|
||||||
"testMatch": ["**/__tests__/**/*.js", "**/?(*.)+(spec|test).js"],
|
"js",
|
||||||
|
"json"
|
||||||
|
],
|
||||||
|
"testMatch": [
|
||||||
|
"**/__tests__/**/*.js",
|
||||||
|
"**/?(*.)+(spec|test).js"
|
||||||
|
],
|
||||||
"verbose": true
|
"verbose": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
tests/env.jest
Normal file
2
tests/env.jest
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
FLUXER_BOT_TOKEN=jest-fluxer-bot-token
|
||||||
|
POSTGRES_PASSWORD=jest-postgres-password
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
jest.mock('@fluxerjs/core', () => jest.fn());
|
import {jest} from "@jest/globals";
|
||||||
jest.mock('../../src/db.js', () => jest.fn());
|
|
||||||
jest.mock('sequelize', () => jest.fn());
|
|
||||||
jest.mock('../../src/enums.js', () => ({
|
|
||||||
enums: jest.requireActual('../../src/enums.js')
|
|
||||||
}));
|
|
||||||
|
|
||||||
const {enums} = require("../../src/enums.js");
|
jest.unstable_mockModule('@fluxerjs/core', () => jest.fn());
|
||||||
const memberHelper = require("../../src/helpers/memberHelper.js");
|
jest.unstable_mockModule('../../src/db.js', () => jest.fn());
|
||||||
|
jest.unstable_mockModule('sequelize', () => jest.fn());
|
||||||
|
|
||||||
|
const { EmbedBuilder } = await import ("@fluxerjs/core");
|
||||||
|
const { database } = await import('../../src/db.js');
|
||||||
|
const { EmptyResultError, Op } = await import ('sequelize');
|
||||||
|
import { enums } from "../../src/enums.js";
|
||||||
|
import { memberHelper } from "../../src/helpers/memberHelper.js";
|
||||||
|
|
||||||
describe('parseMemberCommand', () => {
|
describe('parseMemberCommand', () => {
|
||||||
|
|
||||||
11
tests/jest.config.js
Normal file
11
tests/jest.config.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
/** @type {import('jest').Config} */
|
||||||
|
const config = {
|
||||||
|
clearMocks: true,
|
||||||
|
collectCoverage: true,
|
||||||
|
coverageDirectory: "coverage",
|
||||||
|
setupFiles: ["<rootDir>/jest.setup.js"], // path to a setup module to configure the testing environment before each test
|
||||||
|
transform: {},
|
||||||
|
verbose: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
2
tests/jest.setup.js
Normal file
2
tests/jest.setup.js
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
import * as dotenv from "dotenv";
|
||||||
|
dotenv.config({ path: "env.jest" });
|
||||||
Reference in New Issue
Block a user