Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should create a Vue program config if vue is enabled', async () => {
const { getKnownFileNames, files } = await createCompiler({
pluginOptions: { vue: vueEnabledOption }
});
const fileNames = await getKnownFileNames();
let fileFound;
let fileWeWant = unixify(files['example.vue']);
fileFound = fileNames.some(filename => unixify(filename) === fileWeWant);
expect(fileFound).toBe(true);
fileWeWant = unixify(files['syntacticError.ts']);
fileFound = fileNames.some(filename => unixify(filename) === fileWeWant);
expect(fileFound).toBe(true);
});
compiler.run((err, stats) => {
const { warnings, errors } = stats.compilation;
expect(warnings.length).toBe(2);
const [warning, warning2] = warnings;
const actualFile = unixify(warning.file);
const expectedFile = unixify('src/lib/func.ts');
expect(actualFile).toContain(expectedFile);
expect(warning.rawMessage).toContain('WARNING');
expect(warning.rawMessage).toContain('@typescript-eslint/array-type');
expect(warning.rawMessage).toContain(
"Array type using 'Array' is forbidden. Use 'string[]' instead."
);
expect(warning.location).toEqual({
character: 44,
line: 3
});
const actualFile2 = unixify(warning2.file);
const expectedFile2 = unixify('src/lib/otherFunc.js');
expect(actualFile2).toContain(expectedFile2);
expect(warning2.rawMessage).toContain('WARNING');
expect(warning2.rawMessage).toContain('WARNING');
expect(warning2.rawMessage).toContain(
'@typescript-eslint/no-unused-vars'
);
expect(warning2.rawMessage).toContain(
"'i' is assigned a value but never used."
);
expect(warning2.location).toEqual({
character: 5,
line: 4
});
const error = errors.find(err =>
err.rawMessage.includes('@typescript-eslint/array-type')
);
const actualErrorFile = unixify(error.file);
const expectedErrorFile = unixify('src/index.ts');
expect(actualErrorFile).toContain(expectedErrorFile);
expect(error.rawMessage).toContain('ERROR');
expect(error.rawMessage).toContain('@typescript-eslint/array-type');
expect(error.rawMessage).toContain(
"Array type using 'Array' is forbidden. Use 'string[]' instead."
);
expect(error.location).toEqual({
character: 43,
line: 5
});
callback();
});
});
expect(warning2.rawMessage).toContain(
'@typescript-eslint/no-unused-vars'
);
expect(warning2.rawMessage).toContain(
"'i' is assigned a value but never used."
);
expect(warning2.location).toEqual({
character: 5,
line: 4
});
const error = errors.find(err =>
err.rawMessage.includes('@typescript-eslint/array-type')
);
const actualErrorFile = unixify(error.file);
const expectedErrorFile = unixify('src/index.ts');
expect(actualErrorFile).toContain(expectedErrorFile);
expect(error.rawMessage).toContain('ERROR');
expect(error.rawMessage).toContain('@typescript-eslint/array-type');
expect(error.rawMessage).toContain(
"Array type using 'Array' is forbidden. Use 'string[]' instead."
);
expect(error.location).toEqual({
character: 43,
line: 5
});
callback();
});
});
const [warning, warning2] = warnings;
const actualFile = unixify(warning.file);
const expectedFile = unixify('src/lib/func.ts');
expect(actualFile).toContain(expectedFile);
expect(warning.rawMessage).toContain('WARNING');
expect(warning.rawMessage).toContain('@typescript-eslint/array-type');
expect(warning.rawMessage).toContain(
"Array type using 'Array' is forbidden. Use 'string[]' instead."
);
expect(warning.location).toEqual({
character: 44,
line: 3
});
const actualFile2 = unixify(warning2.file);
const expectedFile2 = unixify('src/lib/otherFunc.js');
expect(actualFile2).toContain(expectedFile2);
expect(warning2.rawMessage).toContain('WARNING');
expect(warning2.rawMessage).toContain(
'@typescript-eslint/no-unused-vars'
);
expect(warning2.rawMessage).toContain(
"'i' is assigned a value but never used."
);
expect(warning2.location).toEqual({
character: 5,
line: 4
});
const error = errors.find(err =>
err.rawMessage.includes('@typescript-eslint/array-type')
);
expect(warning2.rawMessage).toContain('WARNING');
expect(warning2.rawMessage).toContain(
'@typescript-eslint/no-unused-vars'
);
expect(warning2.rawMessage).toContain(
"'i' is assigned a value but never used."
);
expect(warning2.location).toEqual({
character: 5,
line: 4
});
const error = errors.find(err =>
err.rawMessage.includes('@typescript-eslint/array-type')
);
const actualErrorFile = unixify(error.file);
const expectedErrorFile = unixify('src/index.ts');
expect(actualErrorFile).toContain(expectedErrorFile);
expect(error.rawMessage).toContain('ERROR');
expect(error.rawMessage).toContain('@typescript-eslint/array-type');
expect(error.rawMessage).toContain(
"Array type using 'Array' is forbidden. Use 'string[]' instead."
);
expect(error.location).toEqual({
character: 43,
line: 5
});
callback();
});
});
const [warning, warning2] = warnings;
const actualFile = unixify(warning.file);
const expectedFile = unixify('src/lib/func.ts');
expect(actualFile).toContain(expectedFile);
expect(warning.rawMessage).toContain('WARNING');
expect(warning.rawMessage).toContain('@typescript-eslint/array-type');
expect(warning.rawMessage).toContain(
"Array type using 'Array' is forbidden. Use 'string[]' instead."
);
expect(warning.location).toEqual({
character: 44,
line: 3
});
const actualFile2 = unixify(warning2.file);
const expectedFile2 = unixify('src/lib/otherFunc.js');
expect(actualFile2).toContain(expectedFile2);
expect(warning2.rawMessage).toContain('WARNING');
expect(warning2.rawMessage).toContain(
'@typescript-eslint/no-unused-vars'
);
expect(warning2.rawMessage).toContain(
"'i' is assigned a value but never used."
);
expect(warning2.location).toEqual({
character: 5,
line: 4
});
const error = errors.find(err =>
err.rawMessage.includes('@typescript-eslint/array-type')
compiler.run((err, stats) => {
const { warnings, errors } = stats.compilation;
expect(warnings.length).toBe(2);
const [warning, warning2] = warnings;
const actualFile = unixify(warning.file);
const expectedFile = unixify('src/lib/func.ts');
expect(actualFile).toContain(expectedFile);
expect(warning.rawMessage).toContain('WARNING');
expect(warning.rawMessage).toContain('@typescript-eslint/array-type');
expect(warning.rawMessage).toContain(
"Array type using 'Array' is forbidden. Use 'string[]' instead."
);
expect(warning.location).toEqual({
character: 44,
line: 3
});
const actualFile2 = unixify(warning2.file);
const expectedFile2 = unixify('src/lib/otherFunc.js');
expect(actualFile2).toContain(expectedFile2);
expect(warning2.rawMessage).toContain('WARNING');
expect(warning2.rawMessage).toContain(
compiler.run((err, stats) => {
const { warnings, errors } = stats.compilation;
expect(warnings.length).toBe(2);
const [warning, warning2] = warnings;
const actualFile = unixify(warning.file);
const expectedFile = unixify('src/lib/func.ts');
expect(actualFile).toContain(expectedFile);
expect(warning.rawMessage).toContain('WARNING');
expect(warning.rawMessage).toContain('@typescript-eslint/array-type');
expect(warning.rawMessage).toContain(
"Array type using 'Array' is forbidden. Use 'string[]' instead."
);
expect(warning.location).toEqual({
character: 44,
line: 3
});
const actualFile2 = unixify(warning2.file);
const expectedFile2 = unixify('src/lib/otherFunc.js');
expect(actualFile2).toContain(expectedFile2);
expect(warning2.rawMessage).toContain('WARNING');
fileFound = fileNames.some(filename => unixify(filename) === fileWeWant);
expect(fileFound).toBe(true);