-
Notifications
You must be signed in to change notification settings - Fork 242
/
disable-type-checks.it.spec.ts
30 lines (25 loc) · 1.24 KB
/
disable-type-checks.it.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { promises as fsPromises } from 'fs';
import { expect } from 'chai';
import chaiJestSnapshot from 'chai-jest-snapshot';
import { File } from '@stryker-mutator/api/core';
import { disableTypeChecks } from '../../src';
import { createInstrumenterOptions } from '../helpers/factories';
import { resolveTestResource } from '../helpers/resolve-test-resource';
describe(`${disableTypeChecks.name} integration`, () => {
it('should be able disable type checks of a typescript file', async () => {
await arrangeAndActAssert('app.component.ts');
});
it('should be able disable type checks of an html file', async () => {
await arrangeAndActAssert('html-sample.html');
});
it('should be able disable type checks of a vue file', async () => {
await arrangeAndActAssert('vue-sample.vue');
});
async function arrangeAndActAssert(fileName: string, options = createInstrumenterOptions()) {
const fullFileName = resolveTestResource('disable-type-checks', fileName);
const file = new File(fullFileName, await fsPromises.readFile(fullFileName));
const result = await disableTypeChecks(file, options);
chaiJestSnapshot.setFilename(resolveTestResource(`${fileName}.out.snap`));
expect(result.textContent).matchSnapshot();
}
});