<commit_before>jest.mock('axios');
jest.mock('../lib/slackUtils');
jest.mock('../lib/download');
jest.mock('fs');

import path from 'path';
import fs from 'fs';

jest.unmock('fs');

// @ts-ignore
fs.virtualFiles = {
	[path.join(__dirname, 'data')]: '',
	[path.join(__dirname, 'data','emoji.json')]: `[{"short_names":["hoge","huga"]}]`,
	[path.join(__dirname, 'data','common_word_list')]: `シコウサクゴ,試行錯誤`,
};

import ponpe from './index';
// @ts-ignore
import Slack from '../lib/slackMock.js';

let slack: Slack = null;

beforeEach(async () => {
	slack = new Slack();
	process.env.CHANNEL_SANDBOX = slack.fakeChannel;
	await ponpe(slack);
});

describe('ponpe', () => {
	it('responds to ぽんぺ出題', async () => {
		const {text, username} = await slack.getResponseTo('ぽんぺ出題');
		expect(username).toBe('ぽんぺマスター');
		expect(text).toMatch(/^ぽんぺをはじめるよ:waiwai:。/);
	});
});
<commit_msg>handle mock/unmock properly also for es6 modules<commit_after>jest.mock('axios');
jest.mock('../lib/slackUtils');
jest.mock('../lib/download');

import path from 'path';
import fs from 'fs';

jest.mock('fs');

// @ts-ignore
fs.virtualFiles = {
	[path.join(__dirname, 'data')]: '',
	[path.join(__dirname, 'data','emoji.json')]: `[{"short_names":["hoge","huga"]}]`,
	[path.join(__dirname, 'data','common_word_list')]: `シコウサクゴ,試行錯誤`,
};

import ponpe from './index';
// @ts-ignore
import Slack from '../lib/slackMock.js';

let slack: Slack = null;

beforeEach(async () => {
	slack = new Slack();
	process.env.CHANNEL_SANDBOX = slack.fakeChannel;
	await ponpe(slack);
});

describe('ponpe', () => {
	it('responds to ぽんぺ出題', async () => {
		const {text, username} = await slack.getResponseTo('ぽんぺ出題');
		expect(username).toBe('ぽんぺマスター');
		expect(text).toMatch(/^ぽんぺをはじめるよ:waiwai:。/);
	});
});
{'fraction_non_alphanumeric': 0.2345258375922771, 'fraction_numerical': 0.0005678591709256105, 'mean_word_length': 5.270462633451957, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5768197', 'n_tokens_mistral': 759, 'n_tokens_neox': 729, 'n_words': 117}