forked from PluralFlux/PluralFlux
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"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
|
||||
},
|
||||
"jest": {
|
||||
"testEnvironment": "node",
|
||||
"coveragePathIgnorePatterns": [
|
||||
"/node_modules/"
|
||||
],
|
||||
"moduleFileExtensions": ["js", "json"],
|
||||
"testMatch": ["**/__tests__/**/*.js", "**/?(*.)+(spec|test).js"],
|
||||
"moduleFileExtensions": [
|
||||
"js",
|
||||
"json"
|
||||
],
|
||||
"testMatch": [
|
||||
"**/__tests__/**/*.js",
|
||||
"**/?(*.)+(spec|test).js"
|
||||
],
|
||||
"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());
|
||||
jest.mock('../../src/db.js', () => jest.fn());
|
||||
jest.mock('sequelize', () => jest.fn());
|
||||
jest.mock('../../src/enums.js', () => ({
|
||||
enums: jest.requireActual('../../src/enums.js')
|
||||
}));
|
||||
import {jest} from "@jest/globals";
|
||||
|
||||
const {enums} = require("../../src/enums.js");
|
||||
const memberHelper = require("../../src/helpers/memberHelper.js");
|
||||
jest.unstable_mockModule('@fluxerjs/core', () => jest.fn());
|
||||
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', () => {
|
||||
|
||||
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